Brent 'Dax' Royal-Gordon
Mon, 18 Jul 2005 15:49:03 -0700
Autrijus Tang <[EMAIL PROTECTED]> wrote:
> This currently works in Pugs:
>
> for [1..10].pairs -> Pair $x { say $x.value }
>
> But this does not:
>
> for [1..10].pairs -> $x { say $x.value }
>
> Because the ruling that pairs must not be bound to parameters that are
> not explicitly declared to handle them. Is this a desirable behaviour?
How much violence would be done to the language if we declared that block (i.e. closure with no "sub" keyword) parameters defaulted to Item|Pair, while sub parameters defaulted to plain Item? I can't imagine named arguments are going to be used very often on blocks, which tend to be things like loop bodies... Right now one of my biggest Perl 6 nits is that the combination of subroutines everywhere and the Pair type's special role in subroutine dispatch makes Pairs a real pain to work with. This would help to fix the problem without creating a new SuperPair type or something similarly silly. -- Brent 'Dax' Royal-Gordon <[EMAIL PROTECTED]> Perl and Parrot hacker