Hi, Yuval Kogman wrote: > On Sat, Aug 27, 2005 at 19:16:55 +0200, Ingo Blechschmidt wrote: > >> my ($head, [EMAIL PROTECTED]) := foo(); > > if foo returns a list of scalars >=2 this is like parameter > unpacking: > > my ($head, [EMAIL PROTECTED]) = *foo(); [...]
Right, but I wanted to drive at the difficulty of making this work, sorry if I was unclear. ($head, [EMAIL PROTECTED]) := foo(); # (Note: := here, not =) This is not a problem, because :='s LHS is a subroutine signature, which means the necessary magic is already there. But there is a problem with the ordinary assignment form: ($head, @tail) = foo(); If the LHS is an ordinary list (i.e., if we don't use help from the grammar/macros), then the @tail would get flattened before it reached the assignment operator. This is turn would cause the statement not to DWIM: my ($head, @tail) = foo(); # is really my ($head, @tail); ($head, @tail) = foo(); # is really (as @tail is empty) ($head, ()) = foo(); # is really ($head) = foo(); # is really $head = foo(); # !!! > for this I think we need an easier solution... Perhaps flattenning > foo instead of adding a slurp, or making yadda yadda in lvalue throw > it's arguments away silently: > > my ($foo, $bar, ...) := foo(); I like that! :) --Ingo -- Linux, the choice of a GNU | self-reference, n. - See self-reference generation on a dual AMD | Athlon! |