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. We've also always had conditional super calls, eg: `if (cond) super();` has been valid in any method, including constructors. But as you say , the real issue we are trying to address now is eliminating exposure of uninitialized non-ordinary objects and support for constructors called as functions. I think we're on a good path to solve those. Unfortunately, I think the super in function header discussion is mostly a distraction and not really helping focus the discussion on the core issues. Allen _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss