Mindaugas Kavaliauskas said:

Since I do not know anything about singletons and doubletons, here is two simple different implementations that came to my mind (and I guess 5 more different approaches can be use to get the expected result):


Hello Mindaugas,

Please forgive me , I wasn't comprehensive enough in my examples and let the wrong idea that I din't know how to simulate singleton-like behavior of a class.

I'm a newbie here, please be patient.   :)

My proposition is that singleton class support for harbour be implemented in such a way that one programmer can declare a singleton class, box it in a library and share it to other harbour users around the world, knowing for sure that nobody could instantiate it more than once per execution (even by mistake) and that there should be no need to provide any exceptional instructions, formalities, tips or tricks with the library to assure that the user will always acess the same unique instance of the class during all the execution of the program, because the class was declared as a singleton class and the machine would know how to deal with it, even if the user doesn't even know what does singleton means.

Regards
Leandro Damasio




_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to