Hello Przemek

Przemysław Czerpak wrote:
> 
> Introducing THREAD INIT PROCEDURES is very bad idea.
> Let's imagine that such feature is used in many different places
> by core, contrib and 3-rd party libraries. In such case even trivial
> few function thread will activate absolutely unnecessary initialization
> code which will consume much more time then the whole thread and this
> cost will have to pay all Harbour users even if they do not plan to use
> features which needs such initialization. It's enough that such code
> will be linked with final application.
> 

Agreed.



> 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.



> The functionality like THREAD EXIT PROCEDURE can be done quite easy.
> Just simply store object with destructor in THREAD STATIC variable
> when your thread starts.
> 

Ok, I got it.



>> 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 ?


Better if encapsulated as :

if( oBcd:isDerivedFrom( "MyCls" ) )
   // program logic...
endif 




> 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.

Thank you for the insight.

Regards
Pritpal Bedi

-- 
View this message in context: 
http://old.nabble.com/INIT-EXIT-Procedures---Thread-Wise-tp27302415p27309905.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to