From: Alan Chen Date: 2001-11-29T04:59:00+09:00 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