ES6 classes: deferring the creation step

Claude Pache claude.pache at gmail.com
Mon Jun 30 09:27:38 PDT 2014


Le 29 juin 2014 à 04:46, Kevin Smith <zenparsing at gmail.com> a écrit :

> Thanks Claude for working this up.
> 
> 
> InitializeThisBindings(nonconstructedObj, obj) abstract operation
> ----------------------------------------------------------------------
> 
> This operation performs the actual initialisation of the this-bindings that were previously deferred:
> 
>    1. Assert `nonconstructedThisObj` is a Non-Constructed Object.
>    2. Assert `obj` is an ordinary object.
>    3. Replace all references to `nonconstructedThisObj` with references to `obj`.
>      (In particular, this step will effectively initialise the this-binding of every function environment record that used to reference `nonconstructedObj`.)
> 
> I was vaguely thinking along similar lines last week, but was stumped at this point.  Is step #3 possible?  You'd basically have to (magically?) replace the "this" binding for any subclass constructors on the call stack.  This is probably a question for Allen.
> 

In fact, what I really need, is that the this-binding acts like a const-binding: It may be uninitialised at first, and will be initialised after the first call to a `super`-method (in most non-buggy code, it will be the super-constructor).

—Claude

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140630/9c16991a/attachment.html>


More information about the es-discuss mailing list