W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2012

[Bug 19571] New: .length should count optional arguments

From: <bugzilla@jessica.w3.org>
Date: Wed, 17 Oct 2012 07:51:08 +0000
To: public-script-coord@w3.org
Message-ID: <bug-19571-3890@http.www.w3.org/Bugs/Public/>

          Priority: P2
            Bug ID: 19571
                CC: mike@w3.org, public-script-coord@w3.org
          Assignee: cam@mcc.id.au
           Summary: .length should count optional arguments
        QA Contact: public-webapps-bugzilla@w3.org
          Severity: normal
    Classification: Unclassified
                OS: All
          Reporter: ayg@aryeh.name
          Hardware: All
            Status: NEW
           Version: unspecified
         Component: WebIDL
           Product: WebAppsWG

Currently the spec says that .length on function objects is equal to the
minimum possible number of arguments.  In particular, optional arguments are
ignored.  This is bad, because it means that if a spec originally defined f(int
x) and later adds an optional argument f(int x, optional int y), there's
absolutely no way to feature-test whether the extra argument is supported. 
Calling f() with two arguments in old browsers will silently ignore the second
argument, which is not useful.

If this is to match ES6, why can't we just change ES6?  Is there a reason ES6
ignores optional arguments for the purposes of .length?  This is a new feature,
so we should be able to change it.  All I was able to find on the subject is:

The length property of a function should be updated to not include optional

— Erik Arvidsson 2010/11/05 22:37

But he doesn't give a reason.

zcorpan just mailed public-script-coord asking that this be changed in both ES6
and WebIDL:

See also Mozilla bug: https://bugzilla.mozilla.org/show_bug.cgi?id=793151

You are receiving this mail because:
You are on the CC list for the bug.
Received on Wednesday, 17 October 2012 07:51:10 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:07 UTC