On Fri Jun 13 2014 at 3:41:02 PM, Allen Wirfs-Brock <al...@wirfs-brock.com> wrote:
> > On Jun 13, 2014, at 12:07 PM, Jussi Kalliokoski wrote: > > > > > > > function Foo () {} > > > > Foo.prototype[Symbol.create] = null; > > @@create methods are normally defined as methods of the constructor > function rather than as an instance method on the prototype. So the above > should be: > > Foo[Symbol.create] = null; > > > > > // ??? > > // Maybe error out, like currently host objects without [[Construct]]: > > // TypeError: Foo is not a constructor. > > new Foo(); > > as currently specified [1] (and after I fix a bug I just noticed) it will > fall back to doing the equivalent of Object.create(). > > I did that to maximize backwards compatibility for this specific situation: > > function Foo() {}; > Foo.__proto__ = null; //in ES6 default @@create inherited from > Function.prototype becomes unavailable > new Foo; //but in ES1-5 this still does the equivalent of > Object.create(); > Hold on. We covered this in one of the face to face meetings and I was of the impression it was decided that we should not have a fallback but instead throw. https://github.com/rwaldron/tc39-notes/blob/48c5d285bf8bf0c4e6e8bb0c02a7c840c01cd2ff/es6/2013-01/jan-29.md#48-refactored-new-operator-and-the-create-method > If we go down the route of eliminating [[Construct]] and are willing to > break backwards compat. for this case, then we could make 'new' throw if a > constructor doesn't have a callable @@create. That would provide a good > way to indicate that a function is not a constructor (which is current > determine based upon it having a [[Construct]] internal method. > > Allen > > > > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss