On 2/21/2014 3:08 PM, Allen Wirfs-Brock wrote:
It might be worth coming up with good terms for "ES5-style optional
arguments" and "ES6-style optional arguments" which can be used
consistently in the spec. They can already be distinguished by
signature, ie:
```js
Array.prototype.reduce ( callbackfn [ , initialValue ] )
Array.prototype.splice (start, deleteCount [ , item1 [ , item2 [ , …
] ] ] )
```
versus
```js
Array.prototype.fill (value, start = 0, end = this.length)
Array.prototype.copyWithin (target, start, end = this.length)
```
Don't put too much weight into that. I've experiment with use the
latter style when define some new methods to see where it is helpfully
more descriptive. I just haven't bother to update all the legacy
methods to use that same style. At some point in the near future I
wall make a pass over the entire document and use consistent
conventions for all function signatres -- either the ES3/5 style or
the default value style. Given the amount of confusion the new style
seems to have case, I may well revert to using the ES3/5 style.
Isn't there a problem with the new contention because some steps are
either implicit or aren't done? For example, `end = this.length` in the
ES5 style would have explicit ToObject conversion on `this` before
getting its length.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss