On Mon, 25 Jan 2010, Pritpal Bedi wrote:
Hi,
> > Anyhow we can think about adding dynamically initialized thread static
> > variables were initialization code is executed when variable is accesed
> > 1-st time, i.e.:
> > thread static s_var init <{code}>
> > <{code}> is evaluated when thread access s_var the 1-st time and its
> > result is assigned to s_var. Such implementation does not cause any
> > overhead in code which never access s_var.
> Exactly this is what I want. Please commit.
It's not such trivial. It's necessary to modify compiler, generated
PCODE and HVM. It will be also good to ask group if such syntax
extension is acceptable:
thread static s_var init { || hb_datetime() }
or maybe we should add to sth.ch:
#command thread static <!var!> init <initcode> => ;
thread static <var> initblock <{initcode}>
and then to compiler support for:
thread static <var> initblock <block>
so programmer can simply make:
thread static s_var init hb_datetime()
> >> 2. Do we have some provison in Class framework to get
> >> the chain of inheritance. This is required for Xbase++ object
> >> method :isDerivedFrom( cClassOrObject ).
> > __clsParent( <nClassHandle>, <cClassName> ) -> <lDerived>
> > i.e.:
> > ? __clsParent( obj:classH, "MYCLS" )
> CLASS Abc INHERIT MyCls
> ENDCLASS
> CLASS Bcd INHERITS Abc
> ENDCLASS
> oBcd := Bcd():new()
> ? __clsParent( oBcd:classH, "MYCLS" ) // what will be the result ?
.T.
> Better if encapsulated as :
> if( oBcd:isDerivedFrom( "MyCls" ) )
> // program logic...
> endif
METHOD isDerivedFrom( cClassName )
RETURN __clsParent( Self:classH, cClassName )
> > We have also commented code for :isDerivedFrom() method in
> > src/vm/classes.c
> > which we can enable if we decide it's usable as general OOP functionality
> > like :CLASSNAME or :CLASSH
> :isDerivedFrom() must be in the core as it is Xbase++ implementation.
> I would prefer to call it directly instead of __clsParent( obj:classH,
> "MYCLS" ).
> Looking forward that it is enabled by default.
There is much more "default" methods in different OOP implementations
in xbase world. I do not think that it's good idea to adding separately
some of them because some of us wants to use it in some project without
bigger vission about final code.
I do not know which system methods use xbase++ and which of them are part
of object and which ones belongs to class object only.
best regards,
Przemek
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour