A new ES6 draft is available
impinball at gmail.com
Tue Jan 20 09:20:41 PST 2015
On Jan 19, 2015 11:32 AM, "Allen Wirfs-Brock" <allen at wirfs-brock.com> wrote:
> On Jan 19, 2015, at 5:32 AM, Fabrício Matté wrote:
> Your second example may break if the constructor is called via
> `.call()`/`.apply()` or as a *CallExpression : MemberExpression* or if it
> has been `.bind()`ed. Although these may look like corner cases, a good
> transform should cover these cases, especially *CallExpression :
> MemberExpression* as it is very common in Node.js land to have
> constructors exported as properties of an exported object.
> This style of `this` testing is what was necessary to distinguish [[call]]
> from [[construct]] under the old ES6 @@create design. And the above edge
> cases were what complicated all of the built-in constructors (and required
> branding checks and initialization flags) to fully cover.
> It was the complexity of correctly identifying those edge cases which lead
> us to recommending that JS code should never try to do it, and JS
> developers shouldn't try to defined classes whose constructors did an
> implicit 'new' when called.
> With 'new.target' that complexity all goes away and I see no particularly
> reason to discourage constructors that 'new' themselves when called as
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss