[Xotcl] "tie" command

Kristoffer Lawson setok at fishpool.com
Fri Jan 24 15:16:46 CET 2003


On Fri, 24 Jan 2003, Gustaf Neumann wrote:

>  we could provide an option -bind <varname> to the new instproc to allow
>  the user to specify a local or a per-object or global variable name,
> but
>  this does not provide reference counting at all. i have started some
> time ago
>  to work on reference counting, and xotcl has some good prerequirements
>  for this: we have tcl_objs for xotcl objects, they maintain already a reference
>  count. the obvious idea is to destroy the object, when the reference count
>  reaches 0. however, practically this showed to be quite tricky in the current
>  implementation since the refcount = 0 condition happens in some unvonveniant
>  situations... i have not given up on this, but it needs a bigger chunk of time to
>  devote to this...

Yes, exactly. Obviously it's all just steps to make some things easier
while refcount based destruction is the absolute solution. However,
as you may have noticed from c.l.t, ref-count -based systems are really
nasty to get done properly. How would you propose to deal with the
situation where a reference is lost, because the object just happens to
be made into a string (ie. some command or procedure does not keep the
Tcl_Obj but just uses the data as a command). F.ex. when building
callback scripts and containing the object handle there, or as an array
key (I think array keys are still just considered to be strings and the
Tcl_Obj form is not retained).

I would absolutely love to see a solution to the above problems. Many
issues would just vanish in an instance.

                              / http://www.fishpool.com/~setok/





More information about the Xotcl mailing list