Outline of exactly how @@create works?

Domenic Denicola domenic at domenicdenicola.com
Wed Aug 7 13:22:56 PDT 2013

From: Allen Wirfs-Brock [allen at wirfs-brock.com]

> Which of these questions are still unanswered by the above doc?

Wow, it was a good document; I'm sad I forgot about it.

I think what's still missing would be some guidance, on when it's needed in designing platform classes or user classes, and why it was used for the new built-ins. (I think this ties in to your caution over in public-script-coord to not use that pattern much.) Also, what would the practical consequences of moving everything into @@create be, ignoring the constructor entirely?

One point I was confused on, that re-reading helped me understand, is that @@create actually creates the object instances; it does not manipulate passed-in instances. Thus, getting ahold of e.g. `Date[@@create]` or `HTMLElement[@@create]` would not allow you to do anything special; you could not e.g. turn a normal object into a `Date`. The most you could do is create an "uninitialized" object, and what that means exactly depends it seems on how much stuff you've shifted into @@create vs. the constructor.

More information about the es-discuss mailing list