Re: [Bug 23056] Function's length property is inconsistent with EcmaScript

On 8/25/13, bugzilla@jessica.w3.org <bugzilla@jessica.w3.org> wrote:
> https://www.w3.org/Bugs/Public/show_bug.cgi?id=23056
>
> --- Comment #3 from Boris Zbarsky <bzbarsky@mit.edu> ---
> The ES6 spec is a bit unclear here.
>
> In particular, see section 8.3.16.6 in the draft you link to, which
> explicitly
> sets the length to the ExpectedArgumentCount of the ParameterList.  And the
> definition of that is on page 201 (section 13.1) and returns:
>
ExpectedArgumentCount includes arguments that may be omitted, but have
defaults, such as String.prototype.slice(s, e), where if e is omitted,
the string's length is used.

| For example, the Function object that is the initial value of the
| slice property of the String prototype object is described under
| the subclause heading “String.prototype.slice (start, end)” which
| shows the two named arguments start and end; therefore the
| value of the length property of that Function object is 2.

Then again, String.prototype.indexOf (searchString, position)'s length
is 1; If position is undefined, 0 is assumed. According to the
explanation in the spec, it should be 2.

WebIDL defines "optional" formally in one place which seems like a good idea.
--
Garrett
Twitter: @xkit
personx.tumblr.com

Received on Monday, 26 August 2013 17:05:34 UTC