On Feb 3, 2014, at 10:22 AM, Claude Pache wrote:

> 
> I think that this bug is indeed  a good reason to use `super(...arguments)` 
> instead of `return super(...arguments)`.
> 
> However, I am slightly worried that, with the ES6 class syntax, the 
> `constructor` method looks like a regular method, but it behaves differently 
> w.r.t. inheritance. So, nonstandard uses of this method (wmay mysteriously 
> fail when used on a super-class.
not really, how do you mean?

> 
> Therefore, it would be nice if `return expression` would be statically 
> forbidden in the `constructor` method when defined using the `class` syntax 
> (but a bare `return` is fine, which slightly complicates the grammar).
> 

I don't think that restriction is really needed.  Even within a class 
declaration, an explicit value return in a constructor body has a consistent 
meaning.  This is really more an issue about appropriate use of super.  Anybody 
using a super call should really understand the contract of the method they 
think they are calling.  If what is being called via super is a constructor 
that (somethings?) returns a substitute value then the subclass constructor 
should know that and appropriate capture and use the value returned from the 
super call.

Allen

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to