Damian Conway:
# What ~> and <~ do is to (respectively) allow arguments and
# invocants to appear in a different position to normal:
# arguments to the left of the subroutine/method name, and
# invocants to the right of the method's argument list.
#
# So, for subroutine arguments, these are exactly equivalent:
#
# ($arg2, $arg3, $arg4) ~> subname $arg1;
# subname ($arg1, $arg2, $arg3, $arg4);
So
@a ~> grep { ... } ~> @b
Is the same as
@b = grep { ... } @a
?
# Notice that, in addition to pipelines, these proposed
# operators give us MTOWTDI with respect to ordering of the
# components of a sub or method call. That is, Perl 6
# subroutines may have prefix and/or postfix argument lists,
# and Perl 6 methods may have invocants that are any(prefix,
# infix, postfix).
...
# Yes. And the inference that most people seem to have drawn
# is that this implies that Perl 6 would still have
# "stand-alone" C<map> and C<grep> functions.
#
# However, I suspect the correct inference is that Perl 6 will
# have C<map> and C<grep> *multimethods*.
As in...
class Array {
...
method grep (Array $ary: Code $code) returns Array {
...
}
method grep (Code $code: Array $ary) returns Array {
...
}
}
? And this would automagically get mapped into Array::grep? (Reminds
me of C++ operator overloading for e.g. "operator +(int,
MyStringType)"...)
--Brent Dax <[EMAIL PROTECTED]>
@roles=map {"Parrot $_"} qw(embedding regexen Configure)
"If you want to propagate an outrageously evil idea, your conclusion
must be brazenly clear, but your proof unintelligible."
--Ayn Rand, explaining how today's philosophies came to be