One question about @@create though... What would this do:
function Foo () {}
Foo.prototype[Symbol.create] = null;
// ???
// Maybe error out, like currently host objects without [[Construct]]:
// TypeError: Foo is not a constructor.
new Foo();
- Jussi
```javascript
function Foo(){}
Object.defineProperty(Foo, Symbol.create, {value: null});
new Foo();
```
Results in `uncaught exception: TypeError: "Symbol(Symbol.create)" is
not a function`.
Whereas this version creates a default object with [[Prototype]] set to
`Bar.prototype`:
```javascript
function Bar(){}
Object.defineProperty(Bar, Symbol.create, {value: void 0});
new Bar();
```
The exact behaviour is specified in CreateFromConstructor(F) and
Construct(F, argumentsList)
-
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createfromconstructor
-
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-construct-f-argumentslist
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss