caller poison pills, revisited (Was: A few arrow function specification issues)

Allen Wirfs-Brock allen at wirfs-brock.com
Mon Apr 23 11:27:20 PDT 2012


On Apr 23, 2012, at 11:15 AM, Brendan Eich wrote:

> Allen Wirfs-Brock wrote:
>> This raises the issue that ES5.1 overlooked poisoning caller/arguments for Function.prototype.  Only function object created using the algorithm in 13.2 have the the poison pill properties and Function.prototype is not specified using 13.2.
> 
> Function.prototype is special already:
> 
> js> Function.prototype
> function () {}
> js> Function.prototype.prototype
> js>
> 
> I think we did the right thing in not adding poisoned pills to it. Was there a capability leak involving Function.prototype that I missed?

caller and arguments properties on functions are a non-standard extension, so the ES spec. can really say whether or not they exist on Function.prototype except by actually defining them. Poison pills prevent an implementation from extending strict functions created via 13.2 from adding such own properties.  It doesn't prevent a new kind of strict function (eg, arrows) that inherit from Function.prototype but is not specified to have poison pills (as suggested by Brendan Benvie)  from  from inheriting an implementation defined caller or arguments property.

Allen


More information about the es-discuss mailing list