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

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

          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
parameters.

— Erik Arvidsson 2010/11/05 22:37
"""
http://wiki.ecmascript.org/doku.php?id=harmony:parameter_default_values

But he doesn't give a reason.

zcorpan just mailed public-script-coord asking that this be changed in both ES6
and WebIDL:
http://lists.w3.org/Archives/Public/public-script-coord/2012OctDec/0039.html

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