Stéphane Payrard wrote:

I would like perl6 to support left-to-right part/sort/grep pipelines.
Left to right syntax is generally good because it facilitates the flow
of reading.

[cut]

Tentative syntax:
  ... is an left-associative operator that has the same precedence as .

[cut]

example:

@data = [ very_long_data_expression ]
(@foo, @bar) := @data...grep { $_ > 0 }...sort { $^b <=> $^a }...part [/foo/, /bar/];
I like the intent, but I'm not sure about the syntax -- nor the statement about precidence: seems to me that the pipe operator
needs a very low precidence, not very high.

In fact, the operator seems to behave pretty much like a low
precidence c<dot> operator: its passes its lhs as the first
arg to the method that follows.

The most obvious (IMHO) syntax for the operator would be
the old arrow operator (->): its a pity its already taken,
and could be ambiguous in this context if overloaded.

An existing convention for low precidence versions of operators
is to use an alphabetic name (e.g. || vs or). perhaps the we
could name this operator C<pp>: its vaguely remenicent of the
word pipe, without subverting that identifier's existing role.
Thus we could write:

@out = @in
pp map { foo }
pp grep { bar }
pp sort { $^a <=> $^b }


Dave.

Reply via email to