On Feb 11, 2008 12:25 PM, Fabian Jakobs <[EMAIL PROTECTED]> wrote: > > > Does anybody know if there is a better way than: > > var statics = qx.Class.getByName(this.classname) > > > > to access the static members/class variables of the "current" (most > > specialized) class from one of its parent class? > > > I think this is the best way to do it.
> > this.self(arguments) returns me those of the parent class. > > > This method will return the class, the method was originally defined in. > I still think this is a good default behavior. The method should > reference always exactly the same static variable, no matter in which > context the method gets called. > > Shouldn't something like this be the default behavior for > > this.self(arguments) (*)? This behavior is quite standard for class > > variables in OO languages. > > > If you want this behavior you can always use member variables. Member variables is both not what I need (for example if you want to count the number of instances), and possibly not efficient (for constants) to be duplicated in every instance instead of being stored globally at the class level. > Why > should it be possible to override static/class variables in sub classes? > Then they would not be truely static. I don't see why you wouldn't want class variables to be overrideable in subclasses. This is how it works in most of the several OO langages I've used. Try it in Python (as you seem to be using it quite a lot), and see what I mean. For the static part, I honestly don't remember if those are overrideable, since I'm using mostly python these days. > > (*) In practice, and given Qooxdoo current way of doing things, you > > can't simply do that, I think. I think you'd have to add a method to > > get one "static attribute" back, which would do that and a recursive > > lookup in the parent class if the attribute is not found in the > > "specialized" class. > > -- Gaëtan de Menten http://openhex.org ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
