> Invocation: B.describe.call(obj) should return "BA". With your library I 
> would expect it to return "BBA".
> 
> Yes, it would. That's a good tricky case. I'm not sure if extra bookkeeping 
> could make sense of that call, as there isn't any information as to where the 
> function fits in to obj's prototype chain -- or if it's part of another 
> prototype chain entirely. I'd like to hope that something could be figured 
> out, but another alternative is for super() within a direct call() or apply() 
> to be an error.

Another problem: What if an instance method makes a super-call?

A slightly less elegant (and performant) variant of your solution that works in 
both of the above cases is:

- Keep track (per object and method) of the object where the previous 
super-call (e.g. super.foo()) ended up.

- Start your search either there or at |this|: look for the *second* occurrence 
of property "foo". [optional: optimize non-|this| case]

-- 
Dr. Axel Rauschmayer
a...@rauschma.de

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



_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to