Uninteresting parameters

Brendan Eich brendan at mozilla.com
Tue Sep 27 12:43:55 PDT 2011


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.

/be


More information about the es-discuss mailing list