> This little bit of magic is a bit too magical for my taste. > > Polymorphism relies on the idea that a subclass overloads base class > members/methods. From the base classes perspective, it's unaware if > a subclass has overloaded something (that's allowed to be overloaded). > > This code doesn't get the current class *as* the base class but rather gets > the > non-overloaded form of the base class. This isn't really something > that most OO systems allow and I think it could lead to major ugliness in the > future.
Not really, in fact this kind of class-side data is really bread and butter of all dynamic languages, and it's how most of them implement polymorphism. They have an associative array (method names -> method bytecode for example) in each class on the hierarchy, and walk the hierarchy for each function call. Doing method lookups like that is not something we can do in C of course, but for data it's perfectly fine IMHO. > I much prefer moving property installation to a function call that is > invoked during base class init. That leaves you without the possibility to inspect static property info, unless you do the gross-ish hack of calling object_new and immediately freeing the object. Paolo