May the defineProperty method of a proxy handler throw a TypeError?

Tom Van Cutsem tomvc.be at gmail.com
Mon Aug 15 01:58:32 PDT 2011


2011/8/11 Tom Van Cutsem <tomvc.be at gmail.com>

> Noted. I'll write up a small strawman to change the signature of
> 'defineProperty' to return a boolean success value. This change should be
> fully compatible with the existing API, as the return value of the
> 'defineProperty' trap is currently ignored.
>

For completeness: it's here: <
http://wiki.ecmascript.org/doku.php?id=strawman:defineproperty_reject_behavior
>

One upwards-compatibility hazard I see is that all current Proxy code that
does not explicitly return a value from its |defineProperty| trap,
implicitly returns |undefined|, which is coerced to |false|. That is
probably not the behavior that was intended.

So, to future-proof if this strawman is accepted, I think it's best to let
existing |defineProperty| traps |return true;|.

Cheers,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110815/6e5fd255/attachment.html>


More information about the es-discuss mailing list