Minimalist Classes

Axel Rauschmayer axel at rauschma.de
Tue Nov 1 11:21:01 PDT 2011


> 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".

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.

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111101/c11b3816/attachment.html>


More information about the es-discuss mailing list