- From: Marcos Caceres <w3c@marcosc.com>
- Date: Sat, 29 Dec 2012 22:17:48 +0000
- To: François REMY <francois.remy.dev@outlook.com>
- Cc: "public-nextweb@w3.org" <public-nextweb@w3.org>
On Saturday, 29 December 2012 at 18:17, François REMY wrote: > > > // let fooInstance be an instance of Foo, got somehow from your API > > > Foo.prototype.test2=Foo.prototype.test; > > > fooInstance.test2(); // fail > > > > > > The above must fail, because test2 is a copy of test whose "this" has changed. > This is not the real issue, as this does not work better: > > Foo.prototype.test2=function() {}; > fooInstance.test2(); // Uncaught TypeError: Object #<Foo> has no method 'test2' > > The problem is that Foo.prototype is not the ‘real’ Object.getPrototypeOf(fooInstance), but an object that inherits its properties; adding more stuff on Foo.prototype doesn’t affect the other one. Gotcha. You are right. Need to fix that. -- Marcos Caceres http://datadriven.com.au
Received on Saturday, 29 December 2012 22:18:20 UTC