On Mon, Sep 11, 2006 at 11:58:28AM +0800, Audrey Tang wrote:
: Consider these cases:
:     [=] $x, $y, $z;
:     [+=] $a, $b, $c;
: 
: S03 is currently inconsistent.  It first says these are not supported:
: 
: The final metaoperator in Perl 6 is the reduction operator.  Any
: infix operator (except for non-associating operators and assignment
: operators) can be surrounded by square brackets in term position to
: 
: But then implies it is on the defaulting table below:
: 
:     [=]()       # undef    (same for all assignment operators)
: 
: I don't see an obvious problem in supporting them as a syntactic  
: expansion.

Except that the left side of an = determines the scalar/list parsing
of the right side, while reduce operators are all list ops, at least
syntactically.  So should this:

    [=] $x, @y, 0

mean this:

    $x = @y = 0;

or should it mean this:

    $x = @y[0] = @y[1] = @y[2] ... = 0;

: But would it be useful? And is there some hidden corners that I missed?

Seems like

    [=] @x, 0

is vaguely useful if we take the latter interpretation.  (And I do
think that's the correct interpretation.)  But maybe that's better
written as

    @x »=« 0

in any case.  On the other hand, I'm not sure how else you'd write

    [+=] @x, 0

Maybe

    @x = reverse [\+] reverse @x;

So I guess we can allow [=] and friends, provided it's understood that
no LHS dwimmery is done.

Larry

Reply via email to