On Sat, Aug 27, 2005 at 08:19:00PM +0200, Ingo Blechschmidt wrote: : 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(); # !!!
Yes, a list in lvalue context must propagate lvalueness to its components. You have to do this anyway to know when autovivication is permissible. The fact that you don't know it's an lvalue till you see the = means you can't just propagate the information down via the first pass of recursive descent. This is why Perl 5 makes separate top-down passes on portions of its tree when it has enough context to do that. Perl 6 will not be immune from this necessity... : > 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! :) That could be made to work, but we've claimed for cultural continuity that assignment will work the same in Perl 6 as it was in Perl 5, so it's not the solution for you problem. Larry