On Sun, 24 Jan 2010, Pritpal Bedi wrote:
Hi,
> 1. Do we have something like thread scoped INIT/EXIT
> procedures. In hbXBP some functions have to be called
> only once and that too before any other code is executed.
> This will facilitate the better performance. Otherwise I
> ever have to check the existance if some variable if
> it is initialized or not.
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.
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.
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.
> 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" )
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
best regards,
Przemek
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour