Function proxy length (Was: length property value for functions with parameter enhancements)

Brendan Eich brendan at mozilla.com
Tue Aug 30 14:23:30 PDT 2011


On Aug 30, 2011, at 2:16 PM, David Bruant wrote:

> Le 30/08/2011 21:40, Brendan Eich a écrit :
>> 
>> On Aug 30, 2011, at 11:00 AM, Andreas Rossberg wrote:
>> 
>>> On 30 August 2011 18:41, David Bruant <david.bruant at labri.fr> wrote:
>>> This would facilitate the author work when it comes to creating functions that look like functions without having to always include some initialization code for .length, .prototype and such. 
>>> It will still be possible to opt-out of .length or .prototype if the author doesn't
>>> 
>>> I don't think it's worth introducing special cases in the semantics, especially not for something like length.
>> 
>> Perhaps, but I think David has a stronger case for opting out of .prototype.
> Actually that's what current function proxies do by default (no .prototype unless otherwise specified). My suggestion is to put a .prototype by default with keeping the option to opt-out (same with .length, etc.)

Right, of course function proxies have to trap in order to emulate .prototype and other properties.


>> Indeed self-hosting some of the ES1-5 builtins requires doing so, somehow.
> Couldn't it be achived with bound functions (which do not have an own "prototype" property)?

Built-ins do not bind |this|, though -- many are generic (IIRC these are the ones V8 self-hosts).

Also, binding costs memory and cycles, it hurts a bit when creating these things. This can add up.

/be
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110830/b7b01b1c/attachment.html>


More information about the es-discuss mailing list