Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

On signatured code attributes of a class

0 views
Skip to first unread message

Joshua Choi

unread,
Apr 6, 2006, 10:03:57 PM4/6/06
to perl6-l...@perl.org
Can you do this? (Forgive synatical errors; I'm a bit behind on this.)

class Foo { has Code:( Str, Str --> Num ) &.somecode }

my Foo $blah .= new :somecode{ $^x cmp $^y }
my Int $x = 2;
my Num $y = Inf;
$blah.somecode( $x, $y );

Does construction of $blah fail because { $^x cmp $^y } doesn't have a
signature of :(Str, Str --> Num)? If not, does $blah.somecode($x, $y) fail
because of type mismatching? (Or is coercion attempted?) And would the
result of { $^x cmp $^y } be evaluated in numeric context? Or is the above
simply wrong?

Thanks in advance.

Postscript: It seems like a lot is happening on #perl6. It's so fast, and
often so divergent, that it would be extremely useful for some guy to
summarize what's happening on it regularly. A thought.

0 new messages