Function.prototype.bind and [[Construct]]

David-Sarah Hopwood david.hopwood at industrial-designers.co.uk
Sat Jan 17 20:04:47 PST 2009


David-Sarah Hopwood wrote:
> Allen Wirfs-Brock wrote:
[...]
>> 6) bound functions have a "prototype" property that is initialized to the value
>>    of the target function's "prototype" property. Both construction and
>>    instanceOf use the bound function's "prototype" value.
> 
> 6a) bound functions have a "prototype" property that is initialized to
>     the value of the target function's "prototype" property, and is
>     non-[[Writable]] and non-[[Configurable]]. Both construction and
>     instanceof use the bound function's "prototype" property.

  6b) bound functions have a "prototype" property that is initialized to
      the value of the target function's "prototype" property, and are
      sealed objects. Both construction and instanceof use the bound
      function's "prototype" property.

The argument for 6b) is that existing code probably does not rely on bound
functions to be mutable. So, making them sealed enhances security without
requiring an explicit call to Object.seal.

-- 
David-Sarah Hopwood ⚥



More information about the Es-discuss mailing list