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

https://www.w3.org/Bugs/Public/show_bug.cgi?id=23056

--- Comment #5 from Boris Zbarsky <bzbarsky@mit.edu> ---
> what exactly is unclear?

How to map the ES setup to WebIDL.

> The above quote is an informal description of ExpectedArgumentCount from an
> informative note.

Sure.  I read the formal algorithm too.

> Right, in particular what WebIDL means by "optional argument". 

In WebIDL, a function can generally speaking have some number of non-optional
arguments, then some number of optional arguments, with or without default
values.  Optional arguments are ones that can be not passed in the
arguments.length sense.  An example:

  void foo(long arg1, long arg2, optional long arg3, optional long arg4 = 5,
           optional long arg5);

This produces behavior similar to this ES function, as far as I can tell:

  void foo(arg1, arg2, arg3, arg4 = 5, arg5) {
    if (arguments.length < 2) { throw TypeError(); }
    // stuff
  }

If I read the ES spec correctly, the .length of such a function would be 3,
correct?  The .length of the WebIDL function shown above is 2 at the moment...

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Wednesday, 28 August 2013 01:34:18 UTC