es-discuss Digest, Vol 52, Issue 117

Mariusz Nowak medikoo+mozilla.org at medikoo.com
Tue Jun 21 01:54:29 PDT 2011




rauschma wrote:
> 
> 
>> var c1 = Object.create(C);
>> obj.one(); // 'A.foo'
> 
> That would be c1.one(), right?
> 

Yes, sorry edited post twice.


rauschma wrote:
> 
> 
> |here| === C and thus the search for super.one starts in B and finds
> A.one.
> 
>> B.two = function () {
>> 	this.three();
>> };
>> B.three =  function () {
>> 	return 'B.three';
>> };
>> C.two = function () {
>> 	super.two();
>> };
>> C.three = function () {
>> 	return 'C.three';
>> };
>> 
>> var c2 = Object.create(C);
>> c2.two();  // C.three
> 
> |here| === C and thus super.two === B.two
> 
> B.two() uses the original and unchanged |this| which is still c2.
> => this.three === C.three
> 
> SUMMARY: I agree with your findings.
> 

>From my perspective, this proposal looks perfect. I wouldn't look further :)

-----
Mariusz Nowak

https://github.com/medikoo
-- 
View this message in context: http://old.nabble.com/Re%3A-es-discuss-Digest%2C-Vol-52%2C-Issue-117-tp31889060p31892405.html
Sent from the Mozilla - ECMAScript 4 discussion mailing list archive at Nabble.com.



More information about the es-discuss mailing list