|
From: Kristoffer L. <se...@fi...> - 2005-09-28 17:58:57
|
On 28 Sep 2005, at 20:32, Zoran Vasiljevic wrote:
> In Tcl, I (mostly) do not care about when/how *something*
> (there are exceptions to that, rather) is allocated or
> deallocated. The Tcl does this for me == I'm more productive.
> Why would OO objects be different?
>
> A kind of simple refcounting mechanism?
>
> We have that already on the Tcl_Obj level. I'm wondering if we
> can employ such when dealing with OO objects? An Tcl_OO thing?
> Or am I leaning too much out of the window? Needless to say that
> I didn't think of the implementation yet. Just the idea seems very
> sexy.
>
> Would that be doable at all?
This kind of thing has actually been discussed umpteen times.
Unfortunately it's not currently possible to do it in a foolproof
way. As everything is a string, a list of objects might get turned to
a string and the original objects lost (f.ex. apparently [eval] does
this). That would result in all the objects being destroyed, assuming
that was their only reference.
I'd love to see a working scheme like that too. Memory management
should be automatic, if at all possible. This is just one area where
Tcl's design principles make it more difficult. If the ladder-strings
ever get implemented, there's a chance refcount based object
management could be mostly workable.
/ http://www.fishpool.com/~setok/
|