Leopold Toetsch <[EMAIL PROTECTED]> wrote:

On May 21, 2006, at 19:13, chromatic wrote:

> That's unfortunate.  I thought :flat was like the splatty behavior in
> Perl 6.

Reading up and down the S and As, I don't see any indication that Perl6
is using anything other then positional arguments for multi dispatch.

I think chromatic means that he thought :flat _was_ positional. That's
certainly what I thought. 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?

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.

--
matt diephouse
http://matt.diephouse.com

Reply via email to