On 13 June 2014 12:33, Tom Van Cutsem <[email protected]> wrote: > One important detail: > > Jason proposes: > new C(...args) => C[Symbol.new](...args) > > Allen proposes: > new C(...args) => C.apply(C[Symbol.create](), args) > > I prefer Jason's transformation for the following reason: imagine a proxy > that wants to implement e.g. a flyweight pattern (i.e. it wants to pool or > cache objects, rather than constructing a fresh object for each call to > |new|). This is trivial to do with Jason's transformation, because the proxy > is in control of *both* object allocation and initialization. With Allen's > transformation, we need to jump through some hoops if the cached object > returned by Symbol.create depends on args (which is common for flyweights), > as they only get passed in after Symbol.create returns.
I strongly prefer Allen's version. Frankly, I'm already quite concerned about the proliferation of extension hooks for fringe use cases in ES6. Allen's version is a net win in language complexity, while the other is not. /Andreas _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

