View · Search · Index
No registered users in community xowiki
in last 10 minutes

[Xotcl] "tie" command

From: Kristoffer Lawson <setok_at_fishpool.com>
Date: Fri, 24 Jan 2003 05:32:40 +0200 (EET)

Been thinking if this would make sense:

while {$stuff} {
  tie myVar [MyClass new]
  ...
}

And the instance created from MyClass would be automagically collected on
each iteration. Ie. [tie] would tie an object to a variable: when the
variable's value is changed, or when the variable is destroyed, the object
is too -- or at least the refcount decreased. I often have Message objects
which are used once (after some data is read from somewhere) and then
destroyed. Quite often I forget the latter part ;-)

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