Re: Super-calls

2011-10-03 Thread Axel Rauschmayer
On Oct 2, 2011, at 1:55 , Lasse Reichstein wrote: On Sat, Oct 1, 2011 at 5:36 PM, Axel Rauschmayer a...@rauschma.de wrote: Am I right that super-calls only works for class methods, because they know the, statically determinable, prototype chain of its instances, and therefore it knows

Re: Super-calls

2011-10-03 Thread Erik Arvidsson
On Mon, Oct 3, 2011 at 14:50, Axel Rauschmayer a...@rauschma.de wrote: It’s a performance thing support for dynamic super would slow everything down and is thus not worth it. In the current spec, there is a method for moving methods with super from one object to another. It’s not as elegant,

Re: Super-calls

2011-10-03 Thread Quildreen Motta
On 03/10/11 19:49, Erik Arvidsson wrote: On Mon, Oct 3, 2011 at 14:50, Axel Rauschmayera...@rauschma.de wrote: It’s a performance thing support for dynamic super would slow everything down and is thus not worth it. In the current spec, there is a method for moving methods with super from one

Re: Super-calls

2011-10-03 Thread Axel Rauschmayer
class B { a() { this.b(); } b() { print('B.b'); } } class C extends B { a() { super.a(); } b() { print('C.b'); } } var c = new C; c.a(); // Should print 'C.b' With a dynamic super the above would lookup b in the wrong object (B.prototype instead of

Re: Super-calls

2011-10-03 Thread Axel Rauschmayer
From: Quildreen Motta quildr...@gmail.com Subject: Re: Super-calls Date: October 4, 2011 1:19:33 GMT+02:00 To: es-discuss@mozilla.org On 03/10/11 19:49, Erik Arvidsson wrote: On Mon, Oct 3, 2011 at 14:50, Axel Rauschmayera...@rauschma.de wrote: It’s a performance thing support

Re: Super-calls

2011-10-03 Thread Quildreen Motta
On 03/10/11 20:44, Axel Rauschmayer wrote: super being rare and moving methods being rarer, I think the tradeoff for performance is OK, especially as there will be a method that allows you to move methods. If performance wasn’t an issue, dynamic super would be preferable. Hm, I wouldn't

Re: Super-calls

2011-10-03 Thread Allen Wirfs-Brock
invocations should be considered a JS antipattern. Allen François From: John J Barton Sent: Saturday, October 01, 2011 6:16 PM To: François REMY Cc: Brendan Eich ; Axel Rauschmayer ; es-discuss Subject: Re: Super-calls On Sat, Oct 1, 2011 at 9:05 AM, François REMY

Re: Super-calls

2011-10-03 Thread Axel Rauschmayer
So you are asking how super works with generic methods? Good question. Statically, things are easy: super.describe() at (*) will always invoke oddball.describe() Dynamically, things are tricky. call() would have to use the here of object.describe which is object. Thus, super.describe() would

Re: Super-calls

2011-10-03 Thread Allen Wirfs-Brock
On Oct 3, 2011, at 5:15 PM, Quildreen Motta wrote: On 03/10/11 20:44, Axel Rauschmayer wrote: super being rare and moving methods being rarer, I think the tradeoff for performance is OK, especially as there will be a method that allows you to move methods. If performance wasn’t an issue,

Super-calls

2011-10-01 Thread Axel Rauschmayer
just trying to understand: how is super different from __proto__? Another way to explain super-calls: Given a chain of prototypes: this - O1 = O2 = O3 Then a super-call is always about letting this stay the same, but finding a later method: If your method lives in O1, you start your search

Re: Super-calls

2011-10-01 Thread Lasse Reichstein
.__proto__.foo.call(this, …) where here means the object that the current method lives in. The effect is then: - here.__proto__: start your search *after* the method’s object and look for foo. - .call(this, …): but keep this the same. Am I right that super-calls only works for class methods

Re: Super-calls

2011-10-01 Thread Brendan Eich
I right that super-calls only works for class methods, because they know the, statically determinable, prototype chain of its instances, and therefore it knows where to start the search. A normal method, e.g., var o = {__proto__: { m: function(x) { alert(x); }}; o.m = function(v) { super

Re: Super-calls

2011-10-01 Thread Axel Rauschmayer
Am I right that super-calls only works for class methods, because they know the, statically determinable, prototype chain of its instances, and therefore it knows where to start the search. Yes that’s a tricky problem. There are two solutions: 1. Keep a dynamic variable here (similar

Re: Super-calls

2011-10-01 Thread John J Barton
object and look for foo. - .call(this, …): but keep this the same. Am I right that super-calls only works for class methods, because they know the, statically determinable, prototype chain of its instances, and therefore it knows where to start the search. A normal method, e.g., var o

Re: Super-calls

2011-10-01 Thread Axel Rauschmayer
*after* the method’s object and look for foo. - .call(this, …): but keep this the same. Am I right that super-calls only works for class methods, because they know the, statically determinable, prototype chain of its instances, and therefore it knows where to start the search. A normal

Re: Super-calls

2011-10-01 Thread François REMY
01, 2011 5:51 PM To: Brendan Eich Cc: Axel Rauschmayer ; es-discuss Subject: Re: Super-calls On Sat, Oct 1, 2011 at 8:22 AM, Brendan Eich bren...@mozilla.com wrote: On Oct 1, 2011, at 4:23 PM, Lasse Reichstein wrote: On Sat, Oct 1, 2011 at 2:16 PM, Axel Rauschmayer a...@rauschma.de wrote

Re: Super-calls

2011-10-01 Thread Axel Rauschmayer
in. The effect is then: - here.__proto__: start your search *after* the method’s object and look for foo. - .call(this, …): but keep this the same. Am I right that super-calls only works for class methods, because they know the, statically determinable, prototype chain of its instances

Re: Super-calls

2011-10-01 Thread François REMY
11, but then you’ve no way to solve the asynchronous pattern (super would remain null and only this would be bound). François From: John J Barton Sent: Saturday, October 01, 2011 6:16 PM To: François REMY Cc: Brendan Eich ; Axel Rauschmayer ; es-discuss Subject: Re: Super-calls On Sat, Oct