On May 31, 2012, at 1:53 AM, Herby Vojčík wrote:
> Hello,
>
> reacting to "super only in classes", I'd like to propose widening it just a
> little bit:
>
> 1. Allow super in every concise methods (in classes, as well as out of them).
Basically this means in object literals (or object extension literals if we
have them)
> 1a. constructor "method" in class definition is also rated as concise method
> for the purpose of 1.
Of course! This is so fundamental that I think everybody is assuming that is
the case.
> 2. Allow
> function [name] (args) extends MemberExpression { body }
> to be sugar for
> class [name] extends MemberExpression { constructor(args) { body } }
> . This allows creating standalone constructor methods that can use super as
> well (and by "extends" (even if it is "extends Object") they are explicitly
> saying "I am here to construct a class").
I'm less concerned about this case because, as you say above, the enhanced
function declaration is semantically very nearly the same as a class
declaration that only contains a constructor. It really doesn't add any new
expressiveness.
> 2a. In "extends-less" constructor functions, do not allow super.
>
> Herby
>
> P.S.: It was told that there are some problems with super -- what are they?
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss