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 <[email protected]>

>  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
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to