new instantiation design alternatives

Andrea Giammarchi andrea.giammarchi at gmail.com
Thu Sep 18 09:30:55 PDT 2014


historically powerful also thanks to its flexibility, I think JS.next
should fall in the first category: base-class constructor calls anywhere -
this makes the second one possible, and also other patterns available too.

my .02

On Thu, Sep 18, 2014 at 4:36 PM, Jason Orendorff <jason.orendorff at gmail.com>
wrote:

> On Tue, Sep 16, 2014 at 6:48 PM, Allen Wirfs-Brock
> <allen at wirfs-brock.com> wrote:
> > On Sep 16, 2014, at 12:57 PM, Brendan Eich wrote:
> >> Allen Wirfs-Brock wrote:
> >>> We have long standing consensus on the current ES6 class design and
> that includes a `super()` constructor call that can be arbitrarily placed
> within the constructor body.
> >>
> >> I'm ok with consensus if it's real and strong. We aren't there yet, and
> AFAIK we never had cow-path-based use-cases for super calls tucked into the
> middle of constructors. We definitely had concerns about uninitialized
> objects, and people wanted to deal with constructor called as function. But
> conditional super()? I don't remember that.
> >
> > The ES6 max-min class and @@create instantiation proposals have always
> allowed arbitrarily placed `super` calls in methods (and up until the
> recent discussions) we treated class constructors as just the `constructor`
> method of the class prototype. The cow path for arbitrarily placed method
> super` is well paved and supports the fully generality of before, after,
> and around specialization in over-riding subclass methods without requiring
> additional syntactic affordance. It's a cow path that is about as old as OO
> programming and is just as applicable to constructor methods as to any
> other kind of method.
>
> I don't think this is really correct. As far as I can tell, the
> established pattern is
>
> - languages that reveal uninitialized objects (Python, Ruby) allow
> base-class constructor calls anywhere
> - languages that ensure the base-class constructor is called (C#, C++,
> Java) require it to be called up front
>
> The proposed changes make ES fall in neither category.
>
> -j
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140918/2b93a221/attachment.html>


More information about the es-discuss mailing list