Helma Logo
main list history
previous version  overview  next version

Version 1 by hannes on 28. July 2006, 08:55

A few days ago, I came across Dean Edward's *Base Class for JavaScript Inheritance|http://dean.edwards.name/weblog/2006/03/base/*. I liked the general idea of adding syntactic sugar to JavaScript class-like inheritance. However, I think some things could be improved:

* the code of the Base class is pretty unreadable, because it tries to do too much in too little space
* methods in parent prototypes are called as this.base(), which looks nice but is far from self-explanatory and easily clashes with application methods or properties
* the this.base property is set to the parent prototype's method before each method call, and reset to its previous value afterwards. This isn't very elegant, and it doesn't deal with exceptions that might be thrown
* extending of priviledged methods is problematic. each constructor in the proto chain that gets called will create its own scope with its own private members and priviledged methods. Overriding priviledged methods will operate on a entirely different set of private variables.

I'll describe my solution in an update to this page. For now, here's the code:

<% this.attachments %>