in reply to Re: Yet Another Way To Get Involved With Perl6
in thread Yet Another Way To Get Involved With Perl6

It needs to be semicolon, but I don't know if Pugs handles semicolon lists correctly yet. When passed to a function not expecting semicolons, they're just treated as commas. But when passed to a function like zip() that is expecting them, semicolons delimit multiple input lists. Saying
zip(@a;@b;@c)
needs to be equivalent to
zip <== @a <== @b <== @c
There are no optional arguments to zip() that I'm aware of, but if there were any, they'd have to come in before the semicolon lists. In other words, semicolon lists are not ordinary positional arguments. They're a way of ordering multiple variadic inputs, invented originally to handle multidimensional slice subscripts, but since then generalized to work with any signature that recognizes them (though what exactly in the signature recognizes them is still somewhat open to negotiation).

However, there are no general guidelines for how to document the as-yet undesigned parts of the design. The best you can do is to make a guess consistent with the current design and see if anyone carps about it. A certain willingness to be sincerely misguided goes with the territory. :-)

Replies are listed 'Best First'.
Re^3: Yet Another Way To Get Involved With Perl6
by ank (Scribe) on Jun 11, 2005 at 21:00 UTC

    Sounds very interesting -- I also read a bit on the supercomma (see below) -- I wonder how these will all fit together -- and I'll try to help find out :)

    Now, about the zip() issue, these are the sources:

    • Just semicolons, no mention of parameters: S04
    • Parameters, general discussion, weave() - see the 4 links after "Supercomma!" (it is an old discussion though).
    • Another example with parameters and commas:
      for zip(@colors=>2, @textures=>1) -> $color1, $color2, $texture { $mix = blend($color1, $color2); draw_circle($mix, $texture); }
      (source: Perl 6 and Parrot Essentials, 2nd edition, 4.3.2.3)