>> This looks like a PUBLIC var initialized with >> an object from an INIT PROC and protected from >> additional instances. > > Thanks Viktor > > Sure it could be explicitly implemented as you suggested for some cases, but > my intention is to propose a more comprehensive solution. > > If singleton clause could be hardcoded in the class declaration, a developer > could program a singleton class and share it with other users without to care > if they know that it has to be instantiated only once or if they know how to > assure acess to a unique instance of it - the class would be a singleton > class and that would be all. > > Singleton classes happen in programming because there are singleton objects > in real life, so the native concept of singleton classes in harbour would > make programming safer, easier and clearer.
I understand, but before we start implementing something brand new native, which BTW leads quite far away as far I can see it, even my simple proposed method can be used without too much concern, and even it can be used by 3rd party libs to provide such singletons, or whatever we call it. AFAICS it's nothing more than a variable (or function) accessible by all program modules with some value, in this case, it's a single instance class. If anything, Harbour may support single instance classes natively to help this case, and this is probably possible to add without deep changes, but I'm not sure we should add a brand new base variable type/scope/implementation until we know all the benefits which this can give us over already existing methods. Few of us have proposed solutions, it'd be nice if you could comment on them. Brgds, Viktor _______________________________________________ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour