garbage collection misconception
Posted: Sat Jul 09, 2005 4:32 pm
newLisp avoids a garbage collection by nice way - use copying of values in assignments and function calls.
But copying of values is not sufficient to serve real programming needs - and so, we have "contexts" techinics in newLisp, that allows passing by reference.
But, if contexts are subject of dynamic creation and referencing, then they are also the subject of garbage collection!
I'll explain: Suppose, I want to build tree of objects. So, each object will be in separate context, and some of it's variables will contains contexts, holding other objects.
So, I load such tree from somewhere, then found subtree, that I'm interesting for, got the reference to it's root object and then want to destroy whole tree and save interesting subtree for later usage.
With garbage collection I simply will not be worry about that.
But in newLisp I must explicitly copy my subtree to new objects, because the fact of referencing will not protect my objects from destroing.
Possible, here is a point to improvement?
But copying of values is not sufficient to serve real programming needs - and so, we have "contexts" techinics in newLisp, that allows passing by reference.
But, if contexts are subject of dynamic creation and referencing, then they are also the subject of garbage collection!
I'll explain: Suppose, I want to build tree of objects. So, each object will be in separate context, and some of it's variables will contains contexts, holding other objects.
So, I load such tree from somewhere, then found subtree, that I'm interesting for, got the reference to it's root object and then want to destroy whole tree and save interesting subtree for later usage.
With garbage collection I simply will not be worry about that.
But in newLisp I must explicitly copy my subtree to new objects, because the fact of referencing will not protect my objects from destroing.
Possible, here is a point to improvement?