> Le 31 juil. 2016 à 05:12, Michał Wadas <[email protected]> a écrit :
> 
> this.constructor.prototype.baz
> 
> 

No, that is the prototype of the class of the object, which may reasonably be a 
subclass (and which can be anything in the most general cases).

What is the issue with just `Foo.prototype`?

—Claude

>> On 31 Jul 2016 3:03 a.m., "/#!/JoePea" <[email protected]> wrote:
>> Currently we use
>> 
>> ```js
>> class Foo {
>> 
>>   bar() {
>> 
>>     // we want the current prototype's (HomeObject's?) `baz` method, not the 
>> leafmost prototype's (this') `baz` method.
>>     Foo.prototype.baz()
>> 
>>   }
>> 
>>   baz() {
>>     // ..
>>   }
>> 
>> }
>> ```
>> 
>> What about a shorthand keyword like `current` for the "current prototype"?
>> 
>> ```js
>> class Foo {
>> 
>>   bar() {
>> 
>>     // we want the current prototype's (HomeObject's?) `baz` method, not the 
>> leafmost prototype's (this') `baz` method.
>>     current.baz()
>> 
>>   }
>> 
>>   baz() {
>>     // ..
>>   }
>> 
>> }
>> ```
>> 
>> What about `prototype`, because that word is, afterall, owned by JavaScript 
>> (though more likely to break code than `current`).
>> 
>> ```js
>> class Foo {
>> 
>>   bar() {
>> 
>>     // we want the current prototype's (HomeObject's?) `baz` method, not the 
>> leafmost prototype's (this') `baz` method.
>>     prototype.baz()
>> 
>>   }
>> 
>>   baz() {
>>     // ..
>>   }
>> 
>> }
>> ```
>> 
>> Or, since `HomeObject` is a thing, maybe a `home` keyword would be 
>> intuitive, although that is also more likely to break existing code than 
>> `current`?
>> 
>> ```js
>> class Foo {
>> 
>>   bar() {
>> 
>>     // we want the current prototype's (HomeObject's?) `baz` method, not the 
>> leafmost prototype's (this') `baz` method.
>>     home.baz()
>> 
>>   }
>> 
>>   baz() {
>>     // ..
>>   }
>> 
>> }
>> ```
>> 
>> Or a symbol?
>> 
>> ```js
>> class Foo {
>> 
>>   bar() {
>> 
>>     // we want the current prototype's (HomeObject's?) `baz` method, not the 
>> leafmost prototype's (this') `baz` method.
>>     #.baz()
>> 
>>   }
>> 
>>   baz() {
>>     // ..
>>   }
>> 
>> }
>> ```
>> 
>> /#!/JoePea
>> 
>> _______________________________________________
>> 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
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to