From: mark hahn Date: 2001-11-29T06:07:07+09:00 Subject: [ruby-talk:26834] Re: Ref Counting (was KDE or GNOME curiosity question...) At this point my ideas are getting really vague, but I'm thinking that you don't care about just any old reference. You only care about references that care about the finalization. For example, only references to a File object that rely on the object being opened or closed need to be considered when deciding whether the file can be closed at any particular point in time. While this is a very interesting topic, I think our vehicle left planet earth a while ago... I'm thinking now that using scope is the only good way to get quick finalization, with the fopen/block trick being the best example. ----- Original Message ----- From: "Alan Chen" To: "ruby-talk ML" Sent: Wednesday, November 28, 2001 11:59 AM Subject: [ruby-talk:26831] Re: Ref Counting (was KDE or GNOME curiosity question...) > > > On Thu, Nov 29, 2001 at 04:27:58AM +0900, Paul Brannan wrote: > > On Thu, 29 Nov 2001, Matt Armstrong wrote: > > > > > I'm not sure how optional ref counting can be accomplished without > > > overhead everywhere. If object A needed ref counting and object B > > > didn't, ruby would somehow need to increment the reference count of A > > > and not of B when a new object gains a reference to A and B. That > > > implies some run time check or indirection for both objects, true? > > > > There are two alternatives that I see: > > > > 1) Reference counting could be explicit (that is, you would have to call > > add_ref/remove_ref yourself). This would be a pure Ruby solution > > (that is, it could be implemented 100% in Ruby). > > 2) The parser could know whether a given reference is a normal > > refererence or whether it has to increase the reference count of the > > object to which it is pointing; then the decision is made at > > parse-time, rather than runtime, whether to increment/decrement the > > reference count. > > > > Paul > > > How about > > 3) provide a hooks into the current object and GC system such that a ruby mixin can be written that implements reference counting. > > -- > Alan Chen > Digikata LLC > alan@digikata.com > http://digikata.com >