[Harmony proxies] Thoughts on function proxies

Brendan Eich brendan at mozilla.com
Wed Mar 16 10:53:06 PDT 2011


On Mar 16, 2011, at 1:11 AM, Tom Van Cutsem wrote:

> Hi,
> 
> I have no objections to the use cases you're proposing, but in the interest of keeping the Proxy.createFunction method somewhat simple, why isn't the following sufficient:
> 
> // [[Construct]]-less functions:
> var f = Proxy.createFunction(handler, callTrap, function() { throw "can't construct"; });
> 
> // [[Call]]-less functions:
> var f = Proxy.createFunction(handler, function() { throw "can't call"; }, constructTrap);

+1 on leaving users of this case to write it out.


> Distinguishing between |null| and |undefined| to trigger one default behavior or the other feels a bit subtle to me. Are there precedents for this?

Not in ECMA-262.

/be



More information about the es-discuss mailing list