On Tue, Feb 18, 2014 at 11:24 AM, Erik Arvidsson <a...@chromium.org> wrote:

>
> On Tue, Feb 18, 2014 at 1:35 PM, Dimitri Glazkov <dglaz...@google.com>wrote:
>
>> Here's an alternative proposal:
>>
>> 1) The Web developers are already aware of the fact that you can create
>> new instances of JS objects without running their constructors with
>> Object.create
>>
>
> These are not the instances you are looking for.
>
> We need to have real instances here. @@create gives us the semantics for
> doing this.
>

Ah, yes. Sorry :)


>
>
>> 2) Let's make sure that when they call constructors directly (as in var b
>> = new MyB(arg1,arg2);), the constructor is actually called.
>>
>> 3) When the parser instantiates the element, it does the equivalent of
>> Object.create, so no constructor is called.
>>
>
> That would not set the internal state as needed. It would not know how to
> associate the instance object with the C++ backing object for example.
> Also, all the DOM methods are using brand checks (and not instanceof
> checks) so the brand needs to be setup as well.
>
> The solution is to call `MyElement[Symbol.create]()` which would setup the
> internal state as needed. We can make this non writable, non configurable
> which allows the implementation to skip calling any js code at that point
> because the semantics is unobservable.
>
>
>> It seems simple and easy to understand.
>>
>
> With ES6 it is possible to create instance objects without ever calling
> the constructor (this is NOT possible in ES5) so maybe we should just give
> up on having the parser calling the constructor?
>

Sounds good to me.

:DG<

Reply via email to