- From: <bugzilla@jessica.w3.org>
- Date: Sun, 25 Aug 2013 07:21:42 +0000
- To: public-script-coord@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=23056 Bug ID: 23056 Summary: Function's length property is inconsistent with EcmaScript 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. E.g. 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