W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2013

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

From: <bugzilla@jessica.w3.org>
Date: Wed, 28 Aug 2013 01:34:16 +0000
To: public-script-coord@w3.org
Message-ID: <bug-23056-3890-fOzji69AGC@http.www.w3.org/Bugs/Public/>
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 on the CC list for the bug.
Received on Wednesday, 28 August 2013 01:34:18 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:50 UTC