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

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

From: <bugzilla@jessica.w3.org>
Date: Sun, 25 Aug 2013 07:21:42 +0000
To: public-script-coord@w3.org
Message-ID: <bug-23056-3890@http.www.w3.org/Bugs/Public/>

            Bug ID: 23056
           Summary: Function's length property is inconsistent with
    Classification: Unclassified
           Product: WebAppsWG
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: WebIDL
          Assignee: cam@mcc.id.au
          Reporter: dchris@gmail.com
        QA Contact: public-webapps-bugzilla@w3.org
                CC: mike@w3.org, public-script-coord@w3.org

The length property of an Function object returns the "the length of the
shortest argument list of the entries" in the effective overload set. To my
understanding, this means that optional parameters are not counted.

void myOperation(DOMString a, optional DOMString b);

The length property of this function would return 1 as per Web IDL, not 2.
However, the same function would have a length of 2 as per EcmaScript I
believe, which seems a bit inconsistent.

The EcmaScript doc says:
"Every built-in Function object described in this clause—whether as a
constructor, an ordinary function, or both—has a length property whose value is
an integer. Unless otherwise specified, this value is equal to the largest
number of named arguments shown in the subclause headings for the function
description, including optional parameters."

If I understand correctly, optional parameters are accounted for when
calculating the value returned by the length property in EcmaScript but not in
Web IDL. Was this done on purpose?

You are receiving this mail because:
You are on the CC list for the bug.
Received on Sunday, 25 August 2013 07:21:44 UTC

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