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

Mark S. Miller erights at
Fri Jun 17 16:11:41 PDT 2011

On Fri, Jun 17, 2011 at 3:47 PM, David Flanagan <dflanagan at>wrote:

> On 6/17/11 3:05 PM, David Bruant wrote:
>> What about adding a "throw" argument to the defineProperty trap (and any
>> trap for which the equivalent internal method has a "throw" argument) ?
>> The engine would set the boolean value correctly depending on strict
>> mode or any relevant parameter. Trap writers can adapt their behavior
>> based on this boolean.
>> David
>**doku.php?id=harmony:proxies_**semantics<>already defines appropriate Reject behavior (return false or throw) for the
> [[Put]] and [[Delete]] operations based on the return value of the put() and
> delete() traps.

Yes, the reason is that a JavaScript callee cannot sense the strictness of
its caller.

>  [[DefineOwnProperty]] is the only one that does not allow it.
> Given that the fixed properties proposal is adding a return value to
> defineProperty, perhaps returning false would be a suitable way to reject a
> property definition.
>    David

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list