Hi, (sorry for me going into implementation details, but, as it's really a language design question, I refrained from sending this to p6c.)
While trying to make the following work in PIL2JS... my ($head, @tail) = foo(); it occured to me that this is bogus, or at least hard to implement. Without help from the grammar/macros, this translates to the following in PIL: my ($head, @tail); &infix:<,>($head, @tail) = foo(); &infix:<,> is the sub which create lists, e.g. (1,2,3) is really &infix:<,>(1,2,3). Therefore, &infix:<,> has a signature of ([EMAIL PROTECTED]), but this (of course) causes @tail to be flattened before it reaches &infix:<,>, causing the statement not to DWIM. (This corresponds to (@foo, @bar) in Perl-space, which does not evaluate to a list with two elements, but to a list containing @[EMAIL PROTECTED] elements (think @foo.append(@bar))). I see two possible solutions: 1) "Make it work" -- we'll use macros, help from the grammar, or some other technique to make it work. 2) We ask people to use the more clear my ($head, [EMAIL PROTECTED]) := foo(); I.e. we use binding's property that the LHS is a subroutine signature. (Note that I do not talk about the LHS being a list of scalars (e.g. ($a, $b, $c) = foo()), this post only speaks about using lists containing @arrays as lvalues). If we generally recommend this solution especially to newbies, it has got the additional property that my ($foo, $bar) := foo(); will fail if &foo returns more than two things (instead of silently discarding any additional arguments, i.e. assuming my ($foo, $bar, [EMAIL PROTECTED]) := foo(); Opinions? -- Linux, the choice of a GNU | Row, row, row your bits, gently down the generation on a dual AMD | stream... Athlon! |