Function proxies without explicit construct trap

Tom Van Cutsem tomvc.be at gmail.com
Tue Nov 15 20:03:55 PST 2011


Earlier I wrote:

All good points, and I don't recall any of them being intentional. Your
> points seem to suggest changing the semantics such that calling "new
> fproxy()" on a function proxy without a construct trap should perhaps just
> simply throw a TypeError.


Looking at the problem again, the way in which [[Construct]] for function
proxies should have been specced is that if no constructTrap is present,
the function proxy should default to the built-in [[Construct]] algorithm
for Functions (ES5 section 13.2.2, with F now being a function proxy),
rather than calling the callTrap's [[Construct]] method.

This will trigger the "get" trap of the function proxy, to lookup the
"prototype" property, and the new instance will inherit from that.

Cheers,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111115/e1c49c96/attachment.html>


More information about the es-discuss mailing list