Function.length and Default Parameters

Norbert Lindenberg ecmascript at
Fri Oct 12 16:52:10 PDT 2012

Yes. Most of them take locales and options arguments, and those get eagerly filled in with [] and {}, respectively. The last function takes a time value, and defaults to

Now, self-hosted functions have powers that others don't. In the SpiderMonkey self-hosting environment, I can already specify per function whether they should be constructors and whether they should have prototype objects. We may be able to add a way to fake length values too.

More important: These functions were specified this way because TC 39 decided that this is the direction for ES6, and even though ES5 style would have been more convenient for us.


On Oct 12, 2012, at 13:53 , Brendan Eich wrote:

> One more question: are these optional parameters the kind that would want to use parameter default values if self-hosted? If so, that would cement the case for the current spec. Kevin's counter-example would be a "it hurts when I do this!" "don't do it!" thing.
> /be
> Norbert Lindenberg wrote:
>> String.prototype.localeCompare
>> Number.prototype.toLocaleString
>> Date.prototype.toLocaleString
>> Date.prototype.toLocaleDateString
>> Date.prototype.toLocaleTimeString
>> Intl.Collator
>> Intl.Collator.supportedLocalesOf
>> Intl.NumberFormat
>> Intl.NumberFormat.supportedLocalesOf
>> Intl.DateTimeFormat
>> Intl.DateTimeFormat.supportedLocalesOf
>> the function returned by Intl.DateTimeFormat.prototype.format
>> ...are all specified in the ECMAScript Internationalization API Specification as taking optional arguments, but not counting them towards the value of their length properties.
>> Norbert
>> On Oct 12, 2012, at 11:53 , Brendan Eich wrote:
>>> Yes, so given the case Kevin raises of default-ful followed by default-less I agree with Kevin: length should reflect all but rest (if present).
>>> Allen, what built-ins would this break, do you know from checking what built-ins break under the current draft's rule?
>>> /be
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at

More information about the es-discuss mailing list