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

David Bruant david.bruant at labri.fr
Fri May 27 01:28:20 PDT 2011


Le 26/05/2011 22:19, David Flanagan a écrit :
> On 5/26/11 10:46 AM, David Bruant wrote:
>> Le 26/05/2011 18:44, David Flanagan a écrit :
>>> I'd put that distinction in an abstract Proxy.Handler class and then
>>> rename the current Proxy.Handler to Proxy.ForwardingHandler.
>> What do you call a "class" is is a constructor with some arguments?
>> Could you provide a code snippet of how you'd see it work.
> All I really mean is that Proxy.Handler should be an object suitable 
> for use as a handler prototype.
Are you suggesting a "generic" Proxy.Handler (or Proxy.DerivedTraps) or 
something targeted for the forwarding handler use case.
For the forwarding handler use case, I think that [1] addresses what you 
suggest.
For a generic handler object with generic methods, I think it's 
pointless, because there is no such thing like a generic handler method. 
However, if you have examples of what you think would be suitable for 
generic handler methods, any handler object could inherit from, please 
do share code snippets

> Rather than calling it Proxy.Handler, maybe Proxy.DerivedTraps would 
> be better. Then, using Allen's proposed <| operator you could do:
>
> p = Proxy.create(Proxy.DerivedTraps <| {
>    // fundamental traps, and optionally some derived traps defined here
>                            });
Functionally, the current proposal is doing this (without the explicit 
inheritance) with shorter syntax.

David

[1] 
http://wiki.ecmascript.org/doku.php?id=strawman:derived_traps_forwarding_handler


More information about the es-discuss mailing list