seaneagan1 at gmail.com
Tue Sep 27 12:50:26 PDT 2011
On Tue, Sep 27, 2011 at 2:43 PM, Brendan Eich <brendan at mozilla.com> wrote:
> On Sep 27, 2011, at 6:11 AM, Sean Eagan wrote:
>> On Mon, Sep 26, 2011 at 4:47 PM, Xavier MONTILLET
>> <xavierm02.net at gmail.com> wrote:
>>> Normally, you use an object for optional arguments.
>> This is probably the most common case in practice, however...
>>> And there is no good reason not to since you don't care about the order of
>>> the arguments.
>> There are two good reasons:
>> * it's more concise since you don't have to prefix each argument
>> access with the the object argument name + ".", however, destructuring
>> now helps here
>> * library author does not need to introduce argument names, the
>> callback author can use whatever names they want, such as an
>> abbreviations for example
>> Also, there are existing and future in-language APIs which receive
>> multiple argument callbacks, for example:
>> * Array.prototype methods
>> * Proxy traps
> Trailing formal parameters do not need to be declared if not used in JS.
> Holes in parameter lists have some uses as you point out, but they're rare enough that I don't think we should add parameter list holes.
I agree, but it seems like holes in parameter lists would be no more
rare than holes in destructuring lists...
[a, , c] = arr;
...so it seems strange to add it to one but not the other.
More information about the es-discuss