Argument unpacking?

Brendan Eich brendan at mozilla.org
Fri Nov 10 13:15:53 PST 2006


Completely agree, it's hard to DWIM if array actual parameters get  
auto-unpacked without the callee's formal parameter list saying so  
(destructuring formal parameters).  The better design bias IMHO is to  
make callers who want an array actual to be unpacked do more work, be  
explicit about what they want.  So I'm actually in favor of requiring  
something like

   foo.apply(bar, [bletch,crud].concat([some, more, arguments]))

Of course it sucks not to be able to use an operator for array  
concatenation, but that's fixable in ES4 with operators (tangent:  
should we do that in the standard?  E.g., map function +(a:Array,  
b:Array):Array onto concat?).

/be



More information about the Es4-discuss mailing list