Hi Martin,
I think obtaining always the instance of the extended class makes no sense
(can the superclass somehow know it's extended ??) What if it can know that,
but you dont want the extended class anyway?
My use case is that I am using a mock in a test case, and this mock extends
from a real singleton.
So i think the proper way to do it would be to always return the instance of
the class you call getInstance() on; it should check for the presence of
another singleton in the same hierarchy (or just assume it's programmer's
responsability to be careful - there could even be cases where two
singletons of both classes could be actually wanted by the programmer)
Currently we just don't call this.base() on the constructor and this works
fine, but I definitely think it should be improved.
Jean-Noel
On Fri, Feb 19, 2010 at 12:25 AM, MartinWittemann <[email protected]
> wrote:
>
> Hello Jean-Noël,
> extending a singleton class is currently not supported. I think it's not an
> easy task anyway. Both classes do have the getInstance method. But what
> should they return? Always the instance of the extended class, or an
> instance of the class you are using? The last option could get some problem
> if you call it on both classes. You would have two objects which is kind of
> odd for a singleton.
> But you can always patch a class using a mixin, or don't use the qooxdoo
> singleton type and implement the singleton pattern by yourself. But then
> you
> have to take care of the problems I just described.
> Best,
> Martin
> --
> View this message in context:
> http://n2.nabble.com/Extending-a-singleton-class-tp4593441p4596651.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel