The object shouldn't be freed completely in any case, unless the locative is weak. The gc would have to do more bookkeeping to perform partial freeing as you suggest, and I can't see any big advantage with it.
Well, there's one a bit similar case where it would be useful: In the current implementation of nested functions, if a function accesses one variable in a surrounding one then the complete frame of the surrounding function remains. That means that many references to temporary stuff remains after the function returns, which leads to garbage that isn't obvious. If function frames were objects then a partial-free scheme would be a solution to this. It would however have to be done directly when the function returns; doing it in the gc would still be awkward.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-05-13 13:37: Subject: Pointers/lvalues
I think this is called "locatives" in the lisp world. If you have them, they're what you use for locf, setf, incf, etc.
One intersting issue is gc. If you have an object where the only references to it are locatives to some of its instance variables, do you keep the object? Or should you collect the object, and just keep the isolated cells that the locatives point to?
/ Niels Möller (med röd bil)