Rick Waldron (2014-02-03T05:55:19.000Z)
On Sun, Feb 2, 2014 at 5:27 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>wrote:

> I made the change in rev 22 to make the default constructor: return
> super(...args)
>
> However that resulted in this bug:
> https://bugs.ecmascript.org/show_bug.cgi?id=2491 from Arv:
>
> The problem arises when we extend an old school "class" where the code
> does not
> explicitly set constructor.
>
> function B() {}
> B.prototype = { ... }
> class C extends B {}
> new C() instanceof C  // false
>
> The reason why this fails is that `B.prototype.constructor === Object` so
> `new
> C()` returns `Object()`.
>
> The work around is to set `B.prototype.constructor = B` but I feel like the
> problem, adding return added solved, is smaller than the problem it
> introduces.
>
>
> I'm inclined to agree with Arv's conclusion.  What do you think?
>

I think this change should be removed. In fact, I didn't realize this was
actually added to the spec draft--I haven't had the time to review this
draft as I usually do. The fact that JavaScript currently requires
`B.prototype.constructor = B` to get the right constructor is generally
seen as a language bug (whether that's accurate or not, I don't care to
argue the point, subjectively it sucks). While I completely understand the
motivation for the requested change, it's an edge case at best and
apparently I missed the part of the conversation where there was an
agreement to make the change.

Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140203/a37ae96b/attachment.html>
domenic at domenicdenicola.com (2014-02-05T19:42:24.724Z)
I think this change should be removed. In fact, I didn't realize this was
actually added to the spec draft--I haven't had the time to review this
draft as I usually do. The fact that JavaScript currently requires
`B.prototype.constructor = B` to get the right constructor is generally
seen as a language bug (whether that's accurate or not, I don't care to
argue the point, subjectively it sucks). While I completely understand the
motivation for the requested change, it's an edge case at best and
apparently I missed the part of the conversation where there was an
agreement to make the change.