Here are my challenges to you:
1) Suppose object A has to do cleanup before it dies. Also suppose there are
multiple references to A. How can I determine when and who to call Dispose
(if you use Dispose for the cleanup).
2) Suppose there are some other sources who reference A through handles.
That is, those sources do not reference A directly but through an
intermediate handle mechanism. The purpose is not to interfere with the
lifetime management of A, but to use A when it exists and to give it up when
it's gone.
Without GC, I can do them pretty easy and good (for example,in C++). But
now, en... Anybody could give me a solution?
1) Suppose object A has to do cleanup before it dies. Also suppose there are
multiple references to A. How can I determine when and who to call Dispose
(if you use Dispose for the cleanup).
2) Suppose there are some other sources who reference A through handles.
That is, those sources do not reference A directly but through an
intermediate handle mechanism. The purpose is not to interfere with the
lifetime management of A, but to use A when it exists and to give it up when
it's gone.
Without GC, I can do them pretty easy and good (for example,in C++). But
now, en... Anybody could give me a solution?
Comment