[Xotcl] Garbage Collection

Artur Trzewik mail@xdobry.de
Tue, 22 May 2001 21:41:30 +0200


Hi

Thanks for good resource tip to Kristoffer Lawson.
There are good publication at  
http://ftp.sage.usenix.org/events/tcl2k/duffin.html

The Feather tcl extension seems to be very interesting. 
It is shame it was published only as Windows binary
(Kann ein Mensch so tief sinken?)

I have made first attempt to implement it and I have noticed
one big Problem.
source as Xotcl extension
http://www.xdobry.de/xotclref.tar.gz
(copy in xotcl/src and make -f XRMakefile)

example

Class A
set a [A newReference]
$a set var value

by last line the tcl interpreter try to convert my new type
to Tcl_ObjType tclCmdNameType
by this operation the internal representation is freed.
And so the object is deleted before I can use it as command

There can be 2 solution on this problem

1. Special invoke of referenced objects 
    invokeRef $a set var value
   it is probably also used by Feather extension.

2. Overwrite the interal pointers of Tcl_ObjType tclCmdNameType
    SetCmdNameFromAny  see tcl sources generic/tclExecute.c
    it should not freed our new Tcl_ObjType XOTclReferenceObjectType

So I give up. These two solution does not seems to be acceptable.
Maybe futures version of tcl interpeters will offer more flexible
type conversion solution. The new type should decide by itself
how it can be converted to another type.

=========================================

 Artur Trzewik 
 http://www.xdobry.de

=========================================