> Date: Thu, 19 Dec 2002 10:42:27 -0800 > From: Michael Lazzaro <[EMAIL PROTECTED]> > > Honestly, I still don't see what's so evil about R2L as: > > @out = sort given map {...} given grep {...} given @a; > > It seems to solve all the issues with not needing parens, not requiring > {...} to magically eat a trailing comma but-only-sometimes, not needing > to declare C<grep>, etc, in more than one place. And it's arguably > more descriptive than the older (albeit shorter) syntax. And a *lot* > more generically useful for things other than lists/arrays.
As it stands, there's a couple of problems with it. First, IIRC you can't chain post-modifier things. Unless the likely has occurred that Larry changed his mind from 8 months ago :). Another is that C<sort> and company I<should> be methods of Array (inherited or not), and if they're only in one place, then your example would have to be: @out = .sort given .map({...}) given .grep({...}) given @a; The last problem is that R2L is not the problem. It is supported by the basic syntax of the language: @out = sort map {...} grep {...} @a; Or some punctuational variant thereof. If that doesn't work I can honestly say that Perl 6 is not Perl (provided C<sort> and company are declared as forwarder calls, which I don't see a problem with). L2R is the big one that I'm hoping for. The pipe syntax is such a powerful concept from Unix, I'm surprised Perl hasn't stolen it before. > $obj.foo(...); > foo ... given $obj; # identical I don't see how that works. My interpretation: $obj.foo(...); .foo(...) given $obj; # identical Your way works for topic-defaulting calls, as in: sub foo(my $arg //= $topic) is given($topic) {...} foo $obj; foo given $obj; #identical Perhaps I'm missing something? Luke