(Forked from a public-script-coord thread; thought it would be useful to es-discuss as well.)
From: Allen Wirfs-Brock [[email protected]] > 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)`. _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

