Argument unpacking?

Brendan Eich brendan at mozilla.org
Thu Nov 9 13:35:53 PST 2006


I should mention that destructuring formal parameters allow the  
function to take an array actual parameter and bind its elements to  
named formal parameters:

function f(a, [b, c]) { print(a, b, c); }
f(1, [2, 3]) // prints "1 2 3"

This is different yet again.  I wanted to point it out in case it was  
missed (it wasn't specified in the first wiki dump, IIRC).  It's  
implemented in JS1.7 in Firefox 2.

/be

On Nov 9, 2006, at 1:29 PM, Brendan Eich wrote:

> No plans.  Function.prototype.apply is still there, albeit not as  
> powerful or convenient.
>
> I'm still hoping for something in ES4 that makes apply universal  
> (it doesn't work on alert in IE; this should not be allowed by the  
> spec by leaving it up to "host objects" to be broken if they ought  
> to delegate to Function.prototype).  It would also be helpful for  
> bootstrapping if new and apply could be composed; this came up when  
> I wrote Narcissus.  Suggestions?
>
> /be



More information about the Es4-discuss mailing list