On 01.11.2011 22:21, Axel Rauschmayer wrote:
Can you show an example (and also the same example which is solved by
es-proposed super-calls)?
let A = {
describe() {
return "A";
}
}
let B = A <| {
describe() {
return "B"+super.describe();
}
}
let C = B <| {
describe() {
return "C"+super.describe();
}
}
let obj = C <| {};
Invocation: B.describe.call(obj) should return "BA". With your library
I would expect it to return "BBA".
Yes, obviously (and unfortunately). Thanks, it's a good catch.
Though, that's said, this lib was initially designed specially for
class-system (and works in most of cases well); not for class-free
super-calls. Yes, there are some subtle cases which aren't solve.
Furthermore, I don’t think your approach would work here:
let A = {
one() {
return this.two();
}
two() {
return "a";
}
}
let B = A <| {
one() {
return "B"+super.one();
}
two() {
return "b"+super.two();
}
}
let C = B <| {
one() {
return "C"+super.one();
}
one() {
return "b"+super.two();
}
}
let obj = C <| {};
Would obj.one() work? As far as I can tell, your bookkeeping works for
one super recursion only, not for two.
Well, it works at least in respect of that it doesn't go to i-loop and
doesn't break; the result is though "CBca", which seems isn't what you
expect. Thanks for this example as well.
Dmitry.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss