[ES Harmony Proxies] potential inconsistency in the current default 'set' trap

Allen Wirfs-Brock allen at wirfs-brock.com
Tue Jan 25 12:46:44 PST 2011


I have an action item from the last TC39 meeting to review and reconcile the ES5 internal "MOP" with the proxy "MOP"  (ie, the handler interface and traps specification).  I think how I may approach it is to think of native objects as if they were proxies that with a default native handler whose trip implementation replaces the current internal [[ ]] methods.  I think in the course of this there might be some refactoring of the current internal methods along the lines of the current fundamental/derived trap distinction.

The sort of items like this and others in recent threads are something I intend to address in this review.  

Allen


On Jan 25, 2011, at 11:47 AM, Tom Van Cutsem wrote:

> I think you're right, good catch.
> 
> However, before updating the 'set' implementation at <http://wiki.ecmascript.org/doku.php?id=harmony:proxies#trap_defaults> to match the ES5 spec, I wonder if we shouldn't consider the opposite patch: changing ES-harmony's [[Put]] to match the default proxy 'set' behavior.
> 
> Without proxies, the difference between both algorithms would have been unobservable. With proxies, it becomes observable, since using the ES5 algorithm, a default 'set' on an own accessor property would trigger _both_ the getOwnPropertyDescriptor and the getPropertyDescriptor trap (or, if we assume getPropertyDescriptor is itself derived as per the other discussion thread, then getOwnPropertyDescriptor would be called twice). With the default implementation on the wiki, the getOwnPropertyDescriptor trap only gets called once.
> 
> The default 'set' trap currently avoids this artifact at the expense of code duplication.
> 
> Cheers,
> Tom
> 
> 2011/1/25 David Bruant <bruant at enseirb-matmeca.fr>
> Hi,
> 
> I have the impression that the set trap has been written to be consistent with the ES5 [[Put]] algorithm (ES5 section 8.12.5). If it's the case, then the accessor case should only be considered after the call to "this.getPropertyDescriptor(name);", but not before.
> 
> Cheers,
> 
> David
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
> 
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110125/65fd76fb/attachment.html>


More information about the es-discuss mailing list