On Feb 12, 2008 8:37 AM, Fabian Jakobs <[EMAIL PROTECTED]> wrote:
> Gaetan de Menten schrieb:
> > 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?
> >>>
> >>> 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.
> >
> The first example is a good point. This would be much easier with your
> suggestion.

Ok, I'll stick to using my "trick".

> The second one is no problem because of the nature of
> prototype based inheritance.
> All members are stored in the class prototype and as long as you don't
> change the value on an instance the value will be shared by all
> instances. So there is no efficiency problem.

I expected something of the like, but wasn't sure. Thanks for the clarification.

-- 
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

Reply via email to