Referencing `super`

Allen Wirfs-Brock allen at wirfs-brock.com
Tue Aug 5 22:56:10 PDT 2014


On Aug 5, 2014, at 10:11 PM, Brett Andrews <brett.j.andrews at gmail.com> wrote:

> My preference would be for `super()` to remain as-is, and give `super` the equivalent semantics: reference a method of the same name in the parent class (as opposed to invoke). I only provided the alternative since my ultimate view is that `super` and `super()` should function similarly (either both be legal, or both be illegal).

I addressed this in my first replay

On Aug 5, 2014, at 6:37 PM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
> 

> in some languages, such a unqualified 'super' reference would be equivalent to 'this'.

> We intentionally made it an error for that reason.  I perhaps could be convinced that it should mean the same as 'super.submit’.

But it isn’t something we necessarily need to consider for ES6.  We can always relate the error if we find that people really want to do that.  I suspect we won’t.

expressions like:
super = expr;

are probably good examples of DDWIDM. (Don’t Do What I Didn’t Mean)d

in a method named ‘foo’
super = expr;
would be equivalent to 
this.foo = expr;
if ‘foo' was not already defined as an access property (and methods usually are data properties).
Quite likely something the programmer didn’t mean.

Allen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140805/97ed1e81/attachment.html>


More information about the es-discuss mailing list