Karl Glazebrook wrote:
> 
> Buddha Buck wrote:
> > >
> > >   @x = 3 * $y[|i];
> > >
> > >It's not as clean as @x = 3 * @y, but it is cleaner context-wise.
> >
> > And one could argue that:
> >
> >     @x = map 3*^_, @y;
> >
> > is cleaner yet...
> 
> PDL already allows $x = 3*$y
> 
> why step backwards?

Exactly. Those other solutions are plain ugly.

Slightly different messages are conveyed in this regard anyway. Dan
Sugalski wrote at some stage that overloading for arrays is a feature
very likely to be in perl6 while Ilya says this will add to confusion.
?!

With Perl's distinction between scalar and array context is it likely
that

  @x = 3 * @y;

could ever be legal? Would we always have to say

  @x = (3) * @y;

Ilya suggests the array fetch syntax for overloaded operations

  $x = 3 * $y->[3..5];

which is basically current PDL syntax with nicer slicing. That would
leave us with the distinction between those funny array objects and
normal arrays.

Hmmm.

  Christian

Reply via email to