Referencing `super`

Rick Waldron waldron.rick at gmail.com
Wed Aug 6 06:19:39 PDT 2014


On Wed, Aug 6, 2014 at 2:06 AM, Brendan Eich <brendan at mozilla.org> wrote:

> Rick Waldron wrote:
>
>  On Tuesday, August 5, 2014, Domenic Denicola <domenic at domenicdenicola.com
>> <mailto:domenic at domenicdenicola.com>> wrote:
>>
>>     I sympathize; I have always found the fact that bare `super()`
>>     works to be confusing.
>>
>>
>> When a bare super() call appears in a method (whether constructor or not)
>> it can only have _one_ _meaning_ and that's a call to a method of the same
>> name in the parent class. This isn't particularly innovative: John Resig's
>> Simple JavaScript Inheritance[0]—arguably one of the most widely used (many
>> clones, forks and spin-offs exist) "abstract class" techniques—provides
>> `this._super()` which does the same thing that ES6 super() does. This
>> pattern existed before and has been repeated throughout many libraries that
>> have stood out over the years: Prototype, Dojo, Ext.js and certainly
>> others. CoffeeScript implements super() this way as well.
>>
>
> CoffeeScript imitated Ruby here.
>
> Smalltalk had super rather than self sends, but you had to send with the
> full selector (think method name). Java has super() in constructors but
> requires super.method() in methods. I'm cool with super() in methods, I
> forgot we disallowed naked `super`, and my gut says we would support it as
> equivalent to `this`.


To clarify, you don't mean `super === this`, right?

Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140806/3a96e0fb/attachment.html>


More information about the es-discuss mailing list