Re: [Harbour] Singleton Design Pattern in harbour objects

2009-11-25 Thread Leandro Damasio
Hi 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.

Re: [Harbour] Singleton Design Pattern in harbour objects

2009-11-25 Thread Leandro Damasio
Hi I do not see any reason for such limitation. The above #xcommand is universal rule you can define once in some global .ch file and then you can use it as many times as you want in one or many modules. I would only modify it a little bit adding protection against 1-st concurrent call in MT

Re: [Harbour] Singleton Design Pattern in harbour objects

2009-11-25 Thread Leandro Damasio
Hello Mindaugas I do not see a problems here also. In both my and Teo's sample extra class is created but it i not hidden from other users around the world (i.e. MyClass1Real() function is public and visible). It is easy to make this function static and accessible only from same module public

Re: [Harbour] Singleton Design Pattern in harbour objects

2009-11-25 Thread Viktor Szakáts
case, it's a single instance class. Yes Victor, I see your point. I insisted on a deeper aproach because I was hoping the discussion would reach issues like singleton inheritance, but now I understand it's not a convenient discussion for now. If anything, Harbour may support single

[Harbour] Singleton Design Pattern in harbour objects

2009-11-24 Thread Leandro Damasio
Hi, My name is Leandro Damasio and I have started to follow Harbour Project Main Developer List few days ago. I recently started 2D Informatica with my associate Ted, to develop commercial aplications using [x]Harbour. We used xHarbour + BCC55 + HWGUI for about 3 years, until we read

Re: [Harbour] Singleton Design Pattern in harbour objects

2009-11-24 Thread Maurilio Longo
Leandro, On xbase++ you can create them this way http://databear.wordpress.com/2009/08/28/xbase-singleton-pattern/ Maybe you can adopt this to harbour. Maurilio. Leandro Damasio wrote: Hi, My name is Leandro Damasio and I have started to follow Harbour Project Main Developer List few

Res: [Harbour] Singleton Design Pattern in harbour objects

2009-11-24 Thread Fernando Athayde
Enviadas: Terça-feira, 24 de Novembro de 2009 12:26:50 Assunto: [Harbour] Singleton Design Pattern in harbour objects Hi, My name is Leandro Damasio and I have started to follow Harbour Project Main Developer List few days ago. I recently started 2D Informatica with my associate Ted

Re: [Harbour] Singleton Design Pattern in harbour objects

2009-11-24 Thread Massimo Belgrano
A minigui wrapper to qt is done by hbqtcommand a xbase++ wrapper to qt is done by Pritpal in contrib\xhp so a hwgui wrapper will be intresting to try the qt powerfull In future hi hope that we can manage set syntax to cover differences by GUI like designed in vianemo also a wvt wrapper will be

Res: [Harbour] Singleton Design Pattern in harbour objects

2009-11-24 Thread Fernando Athayde
: Re: [Harbour] Singleton Design Pattern in harbour objects A minigui wrapper to qt is done by hbqtcommand a xbase++ wrapper to qt is done by Pritpal in contrib\xhp so a hwgui wrapper will be intresting to try the qt powerfull In future hi hope that we can manage set syntax to cover differences

Re: [Harbour] Singleton Design Pattern in harbour objects

2009-11-24 Thread Leandro Damasio
Leandro, On xbase++ you can create them this way http://databear.wordpress.com/2009/08/28/xbase-singleton-pattern/ Maybe you can adopt this to harbour. Maurilio. Thank you Maurilio The author suggests to use class var and class methods to implement singleton behaviour in xbase++. In most

Re: [Harbour] Singleton Design Pattern in harbour objects

2009-11-24 Thread Leandro Damasio
Athayde Sent: Tuesday, November 24, 2009 12:51 PM To: Harbour Project Main Developer List. Subject: Res: [Harbour] Singleton Design Pattern in harbour objects why don´t you help a development of hbqt, seems a good api (multiplataform), and you can make include files in a hwgui format Thanks

Re: [Harbour] Singleton Design Pattern in harbour objects

2009-11-24 Thread Teo Fonrouge
On Nov 24, 2009, at 9:26 AM, Leandro Damasio wrote: Hi, My name is Leandro Damasio and I have started to follow Harbour Project Main Developer List few days ago. I recently started 2D Informatica with my associate Ted, to develop commercial aplications using [x]Harbour. We used

Re: [Harbour] Singleton Design Pattern in harbour objects

2009-11-24 Thread Leandro Damasio
Hello Teo! I don't understand what do you mean by natively, if you mean to: - Limit the number of instances - automate the instantiation - calling in the app By native singleton pattern class implementation I mean to provide that a class could be declared as a singleton class and that this

Re: [Harbour] Singleton Design Pattern in harbour objects

2009-11-24 Thread Viktor Szakáts
This looks like a PUBLIC var initialized with an object from an INIT PROC and protected from additional instances. Brgds, Viktor On 2009 Nov 24, at 21:54, Leandro Damasio wrote: Hello Teo! I don't understand what do you mean by natively, if you mean to: - Limit the number of instances -

Re: [Harbour] Singleton Design Pattern in harbour objects

2009-11-24 Thread Teo Fonrouge
On Nov 24, 2009, at 2:54 PM, Leandro Damasio wrote: Hello Teo! I don't understand what do you mean by natively, if you mean to: - Limit the number of instances - automate the instantiation - calling in the app By native singleton pattern class implementation I mean to provide that a

Re: [Harbour] Singleton Design Pattern in harbour objects

2009-11-24 Thread Leandro Damasio
Viktor Szakáts said: 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

Re: [Harbour] Singleton Design Pattern in harbour objects

2009-11-24 Thread Mindaugas Kavaliauskas
Hi, Case 1) A singleton class: code PRG //---// CLASS MyClass SINGLETON // THIS IS A SINGLETON CLASS!!! DATA Status INIT 0 METHOD ChangeStatus() INLINE ::Status := 1 ENDCLASS

Re: [Harbour] Singleton Design Pattern in harbour objects

2009-11-24 Thread Leandro Damasio
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 ) ;;

Re: [Harbour] Singleton Design Pattern in harbour objects

2009-11-24 Thread Viktor Szakáts
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

Re: [Harbour] Singleton Design Pattern in harbour objects

2009-11-24 Thread Leandro Damasio
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

Re: [Harbour] Singleton Design Pattern in harbour objects

2009-11-24 Thread Przemysław Czerpak
On Tue, 24 Nov 2009, Leandro Damasio wrote: Hi, 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

Re: [Harbour] Singleton Design Pattern in harbour objects

2009-11-24 Thread Mindaugas Kavaliauskas
Hi, Leandro Damasio wrote: 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