(Weak){Set|Map} subclassing

Jason Orendorff jason.orendorff at gmail.com
Mon Dec 3 15:03:06 PST 2012


On Sat, Dec 1, 2012 at 2:38 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>wrote:

> The simplification I've thought about is eliminating [[Construct]] as an
> internal method/Proxy trap and just making the call @@Create/call
> consturctor sequence the evaluation semantics of the new operator.  But
> I've not yet convinced myself that this is sufficient to capture all of the
> "called as constructor"/"called as a function" semantic silliness that some
> chapter 15 built-ins have. I'm also not sure that DOM and friends don't
> have other dependencies on a reified [[Construt]]
>

The simplification I had in mind was changing [[Construct]] from an
internal method/Proxy trap to an ordinary .@@construct method. There would
be a @@construct/constructor split rather than a
[[Construct]]/@@create/constructor split.

But on reflection, it didn't seem like that would be simpler in practice.
Having two separately hookable phases of object construction is just right.
A class can easily customize either behavior in a way that not only works,
but will still work when the class is subclassed further.

-j
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121203/91895dc6/attachment.html>


More information about the es-discuss mailing list