I am dealing with a very unique problem, one that I have eventually come to assume requires the use of eval. I know that eval is highly inefficient, and so I hope to keep it down to about 3 or 4 evals called at the beginning of a page load, and thats it. Essentially I will need to call eval on every inheritance.
The problem stems from the fact that in order to truly acheive 'classical-inheritance', I need to the ability to call parent functions, and the parent's parent functions. Right now I have a slightly dirty method of calling the same function down an entire chain, through all ancestors. But if I call a parent's function, and from within that parent function, it calls another function, I want that function to be called from the scope of the Parent, not the Child. And right now, it calls the function from the scope of the Child.
My idea is to use tokens, like $this, and $parent within the the function definitions, and then replace those tokens with actual references to the Current class and Parent class, ie. Parent.prototype[method].apply(this, arguments); replaces $parent.method(arguments). The only way I can seem to fix this issue is by doing an eval, as I found no acutal way of applying a variable number of arguments to the Function object.
If anyone else has a better idea I am more than happy to listen. Thank you.