[ES Harmony Proxies] potential inconsistency in the current default 'set' trap
I think you're right, good catch.
However, before updating the 'set' implementation at < 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>
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.
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.