Outline of exactly how @@create works?

Allen Wirfs-Brock allen at wirfs-brock.com
Wed Aug 7 13:02:26 PDT 2013

On Aug 7, 2013, at 12:52 PM, Domenic Denicola wrote:

> (Forked from a public-script-coord thread; thought it would be useful to es-discuss as well.)
> From: Allen Wirfs-Brock [allen at wirfs-brock.com]
>> On Aug 7, 2013, at 12:33 PM, Boris Zbarsky wrote:
>>> Just to make sure I understand the behavior of @@create: it can be invoked to create new objects, but cannot be invoked on an existing object, right?
>> Right, @@create just creates a new, uninitialized instance of a specific kind of object (could be an exotic object with strange internal representation).  It is the responsibility  of operations upon such objects (including the constructors that initialize such instances) to recognize them and whether or not they have been properly initialized.
> Allen, would you have time to write up exactly how @@create works for all of us? I think I understand it, based on piecing together a lot of threads since its inception, but since it will be a very important part of designing solid primitives for the web platform, a more complete outline would be helpful. For example, here are the questions that come to mind for me. I am sure the answers to them overlap substantially.

You should probably start with http://wiki.ecmascript.org/lib/exe/fetch.php?id=meetings%3Ameeting_jan_29_2013&cache=cache&media=meetings:subclassing_builtins.pdf In particular the first half of that deck.

> - What is the difference between @@create and the constructor? Which responsibilities belong to each?
> - How exactly does @@create play a role in subclassing and enabling better subclass support?
> - What role does @@create play in creating well-behaved classes, generally?
> - When is @@create necessary at all? When writing our own classes, or designing classes for the platform, when can we leave it out?
> - How will classes that use @@create differ from those that don't?
> - What problem exactly does it solve that ES5's non-stratified construction falls down for?
> - To what extent is it used in the ES6 built-ins, and for what purpose? Has it been "retrofitted" onto any older built-ins? If so, how does that change their behavior from how they were specced in ES5? If not, what differences does this cause between the older built-ins and newer built-ins?
> - Is there any mechanism in the spec, current or planned, for extracting a class's @@create value? If I got ahold of one, what could I do with it? E.g. `Map[@@create](somethingThatsNotAMap)`.

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130807/6f97265b/attachment.html>

More information about the es-discuss mailing list