Teo Fonrouge said:

> I know that you want to integrate it at low level in the Harbour Object 
> engine, but how about the following sample:
>#xcommand SINGLETON CLASS <clsName> [ FROM <fromCls> ] => ;
>    FUNCTION <clsName>() ;;
>      STATIC obj ;;
>    RETURN iif( obj = NIL, obj := S_<clsName>(), obj ) ;;
>    CLASS S_<clsName> [ FROM <fromCls> ]

Hi Teo,
Yes this is a smart solution, although it is limited to one singleton class per 
module, but my intention is to implement a unified solution to singleton 
classes in shared libraries.
My proposal is that it be implemented in such a way that one developer can 
declare a singleton class, program its composition and behavior, box it in a 
library and share it to other programmers knowing for sure that nobody will can 
double instantiate it and cause error, because he declared to the machine that 
this can't be done.
Best 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