C. Scott Ananian (2014-02-21T21:47:41.000Z)
domenic at domenicdenicola.com (2014-02-24T21:35:59.854Z)
I wasn't confused by the spec text as is, but I'm not surprised that others are. The language is battling against two different "standards" for optional arguments. In ES5 typically "not present" is used; in ES6 for consistency with the new language optional arguments, "undefined" is treated as "not present" and `arguments.length` is ignored. This issue arose in a discussion with the `bluebird` maintainer about the proper semantics for `Promise.reduce`; he wanted to use "ES6 style" for the final optional argument (which meant that you can't use `undefined` as an `initialValue`), while I wanted "ES5 style" to be consistent with the ES5 method `Array#reduce`. 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) ``` Another alternative might be to define a helper function used wherever "ES5-style" optional arguments were used. On the gripping hand, ES5-style optional arguments are actually more similar semantically to ES6 'rest' arguments; perhaps the spec can be written to use a rest argument. For example: ```js Array.prototype.splice (start, deleteCount, ...items) // like in the signature for Array.of() ``` ps. http://esdiscuss.org/topic/changing-behavior-of-array-copywithin-when-used-on-array-like-with-negative-length