develooper Front page | perl.perl6.compiler | Postings from May 2008

Re: [perl #53814] Named/Positional dispatch confusion

Thread Previous | Thread Next
From:
Patrick R. Michaud
Date:
May 7, 2008 06:28
Subject:
Re: [perl #53814] Named/Positional dispatch confusion
On Wed, May 07, 2008 at 02:12:00AM -0700, Stephen Weeks wrote:
> Rakudo currently passes positional arguments into named parameters of
> functions.  This is in violation of S06:748.
> 
> sub a (:$a) { say $a }
> a(1);

There's a somewhat significant mismatch between Perl 6's handling of
arguments and Parrot's handling of them; at the moment Rakudo
is following the Parrot conventions.

My guess at this point is that unless/until Parrot updates its
calling conventions, Rakudo will at some point generate most of 
its subs as

    .sub 'a'
        .param pmc positional :slurpy
        .param pmc named      :slurpy :named
        ...

and then generate code to bind positional/named arguments to
local lexicals according to P6 conventions.


> Possibly related, this also does the wrong thing:
> 
> multi sub t ($a) { say 'one positional' }
> multi sub t ($:a) { say 'one named' }
> t(1);
> 
> Prints: "one named".

I suspect Parrot's MMD here, and since Parrot MMD is due for an
overhaul (pdd27) we'll probably accept this for a while.

Thanks!

Pm

Thread Previous | Thread Next


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About