Setting this to null instead of throwing ReferenceError in a derived class' constructor

Ryosuke Niwa rniwa at
Tue Jan 20 12:06:19 PST 2015

> On Jan 20, 2015, at 11:34 AM, Erik Arvidsson <erik.arvidsson at> wrote:
> How is this different from other TDZ (which happens with let and const bindings)?

Indeed, there are many similarities and the same problem(s) do exist for those cases.  However, for now, we're implementing classes in WebKit at the moment so that's what we're focused now.

Having said that, TDZ was introduced to give "let", "const", and alike a sensible behavior as I understand it.  Since "this" was never defined by "let" or "const", it seems a little arbitrary and inconsistent to make "this" TDZ only inside a derived class's constructor.

> On Tue Jan 20 2015 at 1:52:14 PM Ryosuke Niwa <rniwa at <mailto:rniwa at>> wrote:
> Hi all,
> We've been working on an experimental implementation of ES6 class syntax in WebKit [1].  And we've found that keeping "this" in uninitialized state inside a derived class's constructor is problematic.  It introduces lots of branching around access to "this", which increases memory foot print and startup time.  We can add a special optimizing compiler path to work to try to eliminate these branches but that would only make the startup problem worse and introduces undesirable complexities in our engine.
> Would it be possible to change it so that "this" is set to null until super() is called instead?
> [1] <>
> - R. Niwa
> _______________________________________________
> es-discuss mailing list
> es-discuss at <mailto:es-discuss at>
> <>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list