Chaim Frenkel wrote:
> 
> NW>    $old = assign($var, $val);
> NW>    $old = assign($var) = $val;
> NW>    $old = assign = $var, $val;
>
> I don't think that the assigned values should be moved by perl into
> the argument list.

> You are reintroducing another version of the list flattening problem.
> "Where do the arguments belong"

I don't see how this is true. If this is made to work "correctly":

>         (@foo, @bar) = (@bar, @foo)

Then these would work identically:
 
    @old = flipvals(@foo, @bar);
    $old = flipvals = @foo, @bar;

If arrays are maintained "properly" (not flattened) in Perl, then they
will remain separate, whether as parameters, across = assignments, etc,
etc. The same goes true for mixing arrays and scalars and hashes:

    @stuff = docoolstuff(%hash, $var, @array);
    @stuff = docoolstuff(%hash, $var) = @array;

> By limiting it to only the programmer specified arguments, you reduce
> complexity with no loss of generality.

You do lose the ability to chain subs together, which is neat. For
example, using a sub a middle value to a split():

   @user = ($uid, $x, $p->format) = split /:/, <PASSWD>;

In this case there's no easy way to write this without a couple lines,
which is too bad. But moving assigned values into the arg list fixes
this.

Keep in mind that more complex "true" lvalue subs will still be
available via the :lvalue keyword. This proposal just makes the default
syntax of subs more flexible.

-Nate

Reply via email to