Jonathan Scott Duff wrote:
> I'm wondering how we get both
> 
>       for ($x,$y,$z) (@array) { ... }
> 
> and
> 
>       for ($x,$y,$z) (@array1,@array2,@array3) { ... }

That's an -internals issue.  Suffice it (here) to say that
the parser could be made to handle it.  In fact, to the parser,
it's all the same.  At least if C<for> has the proper prototype.

But as for the semantics... how does perl handle this:

        for ($x,$y,$z) (@a1,@a2) { ... }
and
        for ($x,$y,$z) (@a1,@a2,@a3,@a4) { ... }

Making the case where the number of iterators == the number of arrays
special may not be so good.  Not to mention

        for ($x,$y,$z) (@a1,@a2,4..12,@a4) { ... }

Probably we'll have to say that the user must explicitly zip if that
is what is desired.


> The square bracket syntax is alluring since it implies referenceness,
> but it goes the wrong way; squares enreference rather than dereference.

No; you can dereference on the inside, as you propose, or enreference
on the outside, as I propose.

        for [ $a, $b, $c ] ( @things ) {
                print "They are: $a, $b, $c\n";
        }

The idea is to get pass them en bloc to C<for()>, which will then 
set them up as iterators appropriately.


-- 
John Porter

        We're building the house of the future together.

Reply via email to