Minimalist Classes

Axel Rauschmayer axel at
Tue Nov 1 11:58:52 PDT 2011

Sorry, Jeremy, my comments were directed at Dmitry’s approach, not yours!

However, the call() problem is probably universally tricky, as you say.

Another point to consider: What happens if there are several calls and the last one makes a call (infinite recursion can be prevented via a parameter)

On Nov 1, 2011, at 19:48 , Jeremy Ashkenas wrote:

> On Tue, Nov 1, 2011 at 2:21 PM, Axel Rauschmayer <axel at> wrote:
> Invocation: 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.
> Would work? As far as I can tell, your bookkeeping works for one super recursion only, not for two.
> Yes, would work. You can keep track of the super() depth per-object-per-method ... and even for fancier cases where you restart the same super() chain recursively from the outside. Imagine if one of the deeper's itself calls, with a direct reference to the instance (and a different parameter, to avoid infinite recursion). You can imagine super counters as a stack instead of a value, and push a fresh one on, popping it when the new call exits.

Dr. Axel Rauschmayer
axel at


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list