On Wed, 28 Aug 2002, Luke Palmer wrote:

> > Second, is there a prototype-way to specify the arguments to "for"
> > (specifically, the first un-parentesized multidimensional array argument)?
> > In other words, is that kind of signature expected to be used often enough
> > to justify not forcing people to explicitly extend the grammar?
>
> If you're talking about parallel iteration, I know what you mean.

Yeah, that's what I was talking about, though IIRC "parallel iteration"
refers to how the data is used.  I may be on crack here, but I think that
stuff before the arrow is just a multidimensional array, like

   my @a = (1, 2; 3, 4)

but, since we're expecting it, the parens are optional.

> I think there's a time for a special case, and that's one of them.

I probably agree here (if mucking with the parser is a straightforward
thing to do).

> If you're talking about the regular syntax:
>
>       for @a, @b -> $x { ... }
>
> Would that be:
>
>       sub rof (array *@ars, &body) {...}
>
> or
>
>       sub rof (*@ars is array, &body) {...}

Being able to specify fixed arguments after a splat looks illegal, or at
least immoral.  It opens the door to backtracking in argument parsing,
e.g.:

    sub foo (*@args, &func, *@more_args, $arg, &func) { ... }

> Saying specifically a list of arrays.  Also, would that list gobble up
> everything, or would it actually allow that coderef on the end?

I would expect it to be a syntax error, since the slurp parameter has to
be the last.

/s

Reply via email to