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.
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
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
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
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
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
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
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
: 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
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
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
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
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
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
-
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
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
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
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 ) ;;
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
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
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
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
22 matches
Mail list logo