On Sunday 21 May 2006 13:29, Matt Diephouse wrote:

> I think chromatic means that he thought :flat _was_ positional. That's
> certainly what I thought.

Yes, exactly.  I thought :flat and :slurpy were symmetric.

> Look at the "Flattening argument lists" 
> section of S06:
>
>     sub foo($x, $y, $z) {...}    # expects three scalars
>     @onetothree = 1..3;          # array stores three scalars
>
>     foo(1,2,3);                  # okay:  three args found
>     foo(@onetothree);            # error: only one arg
>     foo([,[EMAIL PROTECTED]);         # okay:  @onetothree flattened to three
> args
>
> In this example, $x, $y, and $z are positional args. I would expect C<
> foo(1,2,3) > and C< foo([,[EMAIL PROTECTED]) > to be identical calls --
> even wrt multi dispatch. $x, $y, and $z are still positional even if
> foo is called with a flattened array, right?

Yes.  The flattening should happen at the point of the call, not at the point 
of argument assignment within the call.

> Autoboxing would make this a bit tougher in Parrot, but if ints box to
> Integer and strings to String, then you can write your multis for
> Integer and String (as chromatic did) and be done with it.

I'm not sure why this matters for anything other than :slurpy; use a 
primitive-holding PMC array and mark it with :flat.

(For Pheme it doesn't matter at all, as it doesn't use primitive types yet, if 
ever.)

-- c

Reply via email to