From: Paul Brannan Date: 2001-11-29T04:27:58+09:00 Subject: [ruby-talk:26828] Re: Ref Counting (was KDE or GNOME curiosity question...) 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