W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2011

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

From: Tom Van Cutsem <tomvc.be@gmail.com>
Date: Mon, 15 Aug 2011 10:58:32 +0200
Message-ID: <CAKDfNj_eCgr9QqcOE=Ff2UT5oXG+ZK3gw_8fDGaPiv+wNF4gsw@mail.gmail.com>
To: "Mark S. Miller" <erights@google.com>
Cc: Cameron McCormack <cam@mcc.id.au>, David Flanagan <dflanagan@mozilla.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>, es-discuss <es-discuss@mozilla.org>
2011/8/11 Tom Van Cutsem <tomvc.be@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
Received on Monday, 15 August 2011 08:58:59 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:04 UTC