@@new

Boris Zbarsky bzbarsky at MIT.EDU
Wed Jun 18 10:07:46 PDT 2014


On 6/18/14, 11:39 AM, Erik Arvidsson wrote:
> This also fits how @@create works for DOM, where the creation of the
> instance would set up the internal DOM wrapper pointer, never exposing a
> non initialized DOM object to user code.

Note that in that setup it's impossible to introduce an HTMLElement 
constructor like this:

   var el = new HTMLElement("iframe");

because the @@create doesn't have the tag name available to create the 
right sort of object...

This is the flyweight object issue that was mentioned up-thread too: if 
you have to examine your arguments to decide what sort of object to 
create, then @@create is not a viable option.

Whether we need to make this sort of constructor possible is a separate 
issue, of course; for newer specs we're using separate interfaces for 
separate things, so don't need this sort of constructor, I think.

-Boris


More information about the es-discuss mailing list