Should the "length" property of bound functions be configurable

Brendan Eich brendan at mozilla.com
Fri Aug 30 12:34:49 PDT 2013


Mark and I discussed this privately a while back. We would rather use 
the same attribute pair for both. Is non-writable configurable ok? I 
argued that for name it is onerous to require Object.defineProperty 
calls, e.g., from Cappuccino when compiling Objective-J into JS, to fix 
up every function's name to tell its Obj-J pathname. But you wrote the 
name proposal -- you should weigh in and even call this shot!

/be

> Brandon Benvie <mailto:bbenvie at mozilla.com>
> August 30, 2013 11:39 AM
> Part of the function name proposal submitted would make "name" 
> writable but not configurable, which is the inverse of the current 
> spec for "length" being configurable but not writable. Seems there 
> needs to be some discussion on what attributes should be where.
>
> On Aug 30, 2013, at 7:36 PM, "Mark S. Miller" <erights at google.com 
> <mailto:erights at google.com>> wrote:
>
>> Cool. In that case we have more freedom. In any case, we should give 
>> both of these the same attributes.
>>
>>
>> On Fri, Aug 30, 2013 at 10:34 AM, Claude Pache 
>> <claude.pache at gmail.com <mailto:claude.pache at gmail.com>> wrote:
>>
>>
>>     Le 30 août 2013 à 18:54, "Mark S. Miller" <erights at google.com
>>     <mailto:erights at google.com>> a écrit :
>>
>>     > It seems we have legacy saying that "name" should be writable.
>>     >
>>
>>     Really? Just tried in the console of the latest stable versions
>>     of Firefox, Safari, Chrome and IE:
>>
>>     ```
>>     Object.getOwnPropertyDescriptor(function() {}, 'name')
>>     ```
>>
>>     Firefox, Safari and Chrome: `{value: "", writable: false,
>>     enumerable: false, configurable: false}`
>>     IE: `undefined`
>>
>>     —Claude
>>
>>
>>
>>
>> -- 
>>     Cheers,
>>     --MarkM
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org <mailto:es-discuss at mozilla.org>
>> https://mail.mozilla.org/listinfo/es-discuss
> Brendan Eich <mailto:brendan at mozilla.com>
> August 30, 2013 9:34 AM
> Allen probably could use a bug on file at bugs.ecmascript.org -- anyone?
>
> /be
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
> Claude Pache <mailto:claude.pache at gmail.com>
> August 30, 2013 5:35 AM
> The `uncurryThis` metafunction, given as example in [1], needs to 
> correct the length of a function produced by `bind`. Simplified version:
>
> ```
> uncurryThis = f => Function.protytpe.call.bind(f) // 
> uncurryThis(f).length == 1 instead of f.length + 1
> ```
>
> So, yes, `bind` should produce functions with mutable length.
>
> —Claude
>
> [1] http://www.mail-archive.com/es-discuss@mozilla.org/msg21786.html
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
> Brandon Benvie <mailto:bbenvie at mozilla.com>
> August 30, 2013 3:54 AM
> The latest spec revision makes the function "length" property 
> configurable (section 8.3.16.6). Function.prototype.bind (15.3.3.5) 
> still produces functions with non-configurable "length", however. I 
> think this may be an oversight, but I'm not sure.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


More information about the es-discuss mailing list