Argument unpacking?

Peter Hall peterjoel at
Sat Nov 11 19:26:16 PST 2006

Allowing additional arguments before the array is confusing. And
aren't you just as likely to want to pass additional arguments after
the array? Using an overridden "+" operator - or concat() for that
matter - doesn't seem like much of a burden.

Also, unless I'm missing something, the language wouldn't be able to
enforce the type of that last array argument any more. So, while this
feature would be backwards compatible, it would mean losing something
and, even though that thing is small, it doesn't look like much is
being gained either.


On 11/12/06, P T Withington <ptw at> wrote:
> On 2006-11-10, at 15:21 EST, Johan Sundström wrote:
> [...]
> > On 11/10/06, P T Withington <ptw at> wrote:
> >> My example was poor.  Replace `rest` with `[some, more, arguments]`.
> >>
> >> What I'd like to say:
> >>
> >>    foo.apply(bar, bletch, crud, [some, more, arguments])
> >
> > Imagine you wanted to pass the literal argument array ["bletch",
> > "crud", ["some", "more", "arguments"]] (yes, the third argument being
> > an array) to a which takes three arguments. It could of course
> > still be done, by way of either of these syntaxes:
> >
> >   foo.apply(bar, "bletch", "crud", ["some", "more", "arguments"], []);
> >   foo.apply(bar, "bletch", "crud", [["some", "more", "arguments"]]);
> Then I would not use `apply`.  I would use `call`.
>, "bletch", "crud", ["some", "more", "arguments"]);
> This is exactly the difference between `call` and `apply`.  `apply`
> takes an Array and 'spreads' the arguments out to `call`.  All I was
> asking is to amend `apply` to allow you to specify additional spread
> arguments before the Array.
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at

More information about the Es4-discuss mailing list