From: Mathieu Bouchard Date: 2001-05-16T11:19:37+09:00 Subject: [ruby-talk:15231] Re: Discussion on new Ruby features On Wed, 16 May 2001, Yukihiro Matsumoto wrote: > The only elegant solution I can think of: > > * introduce reference counting. > > * + for String and Array (and others) concat to self, if reference > count is 1, which means there's no alias to the object. What do you think of adding an extra level of indirection? Maybe String objects could point to a datastructure like: struct InnerString { int refcount; /* how many RSTRINGs point to this struct */ int length; int capacity; char data[0]; }; So that you don't need to add reference counting anywhere else than in String. matju