> Date: Wed, 08 Jan 2003 12:14:10 +0800
> From: Damian Conway <[EMAIL PROTECTED]>
> 
> Can I suggest that an alternative solution might be the following:
> 
>      Suppose Perl 6 had two new very low precedence operators: ~> and <~
>      (a.k.a. "bind rightwards" and "bind leftwards")
> 
>      Suppose ~> takes its left argument and binds it to
>      the end of the argument list of its right argument,
>      then evaluates that right argument and returns the result.
>      So an L2R array-processing chain is:
> 
>          @out = @a ~> grep {...} ~> map {...} ~> sort;
> 
>      There might also be a be special rule that, if the RHS is
>      a variable, the LHS is simply assigned to it. Allowing:
> 
>          @a ~> grep {...} ~> map {...} ~> sort ~> @a;
> 
>      Further suppose that <~ takes its right argument, and binds
>      it in the indirect object slot of the left argument, which
>      argument it then calls. So an R2L array-processing chain is:
> 
>          @out = sort <~ map {...} <~ grep {...} <~ @a;
> 
>      Or, under a special rule for variables on the LHS:
> 
>          @out <~ sort <~ map {...} <~ grep {...} <~ @a;
> 
> That way, everything is still a method call, the ultra-low precedence of
> <~ and ~> eliminate the need for parens, and (best of all) the expressions
> actually *look* like processing sequences.

I think this is a big step towards readability.  It allows you to put
whatever part of the expression wherever you want (reminiscent of
Latin); i.e. always keep the important parts standing out.  I also
think that the operator (especially a cool 3d-looking one like ~>) is
also much more readable than a word in this case. 

It's a shame <~ is ambiguous.  It's a lexical ambiguity, which can be
solved with whitespace.... 

Luke

Reply via email to