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

David Flanagan dflanagan at
Fri Jun 17 15:47:57 PDT 2011

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 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.  [[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.


More information about the es-discuss mailing list