We don't bite newbies here... much | |
PerlMonks |
Re^6: Perl6 Contest #2: P6 That Doesn't Look Like P5by tall_man (Parson) |
on Jun 08, 2005 at 18:17 UTC ( [id://464778]=note: print w/replies, xml ) | Need Help?? |
I don't believe it will ever be possible to put named parameters after slurpy parameters. From E06:
An important restriction on named arguments is that they cannot come before positional arguments, or after any arguments that are bound to a slurpy array. Otherwise, there would be no efficient, single-pass way of working out which unnamed arguments belong to which parameters. But apart from that one overarching restriction (which Larry likes to think of as a zoning law), we’re free to pass named arguments in any order we like. That’s a huge advantage in any subroutine that takes a large number of parameters, because it means we no longer have to remember their order, just their names. So this looks like the reason for my bug also. Named parameters cannot come before *@lst (because it's positional) and they cannot come after (because it's slurpy) so the declaration is invalid. By the way, the "+" for "named only" doesn't really mean it. I found this astonishing code in the test cases:
If that is legal, what's the difference between a "+" prefix and a "?" prefix on a parameter?
In Section
Seekers of Perl Wisdom
|
|