W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2013

Outline of exactly how @@create works?

From: Domenic Denicola <domenic@domenicdenicola.com>
Date: Wed, 7 Aug 2013 19:52:23 +0000
To: Allen Wirfs-Brock <allen@wirfs-brock.com>, Boris Zbarsky <bzbarsky@mit.edu>
CC: Travis Leithead <travis.leithead@microsoft.com>, "es-discuss@mozilla.org" <es-discuss@mozilla.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <B4AE8F4E86E26C47AC407D49872F6F9F878A7BB8@BY2PRD0510MB354.namprd05.prod.outlook.com>
(Forked from a public-script-coord thread; thought it would be useful to es-discuss as well.)

From: Allen Wirfs-Brock [allen@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.

- 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)`.
Received on Wednesday, 7 August 2013 19:53:07 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:17 UTC