CreateFromConstructor

Axel Rauschmayer axel at rauschma.de
Sat Nov 1 20:23:27 PDT 2014


https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createfromconstructor <https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createfromconstructor>

Isn’t the name of that operation misleading? How about the following changes?

* Rename `CreateFromConstructor` to `CreateViaCreateAction`.
* Throw an exception in step 3.

CreateFromConstructor is only used in two locations:

* 7.3.18 Construct (F, argumentsList)
    * Change step 2 so that `CreateViaCreateAction` is called if `F` has a property `[[CreateAction]]` and `OrdinaryCreateFromConstructor` otherwise.
* 25.4.1.6 NewPromiseCapability ( C )
    *  `CreateFromConstructor` being used here effectively means that you must subclass `Promise` (the note sounds like that is desired). `CreatePromiseCapabilityRecord` re-implements the constructor protocol. I’d prefer it if that duplication of functionality didn’t happen and (e.g.) `Construct()` could be used, but that may be too complicated a change.

-- 
Dr. Axel Rauschmayer
axel at rauschma.de
rauschma.de



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


More information about the es-discuss mailing list