From: Robert Klemme Date: 2009-01-22T22:28:22+09:00 Subject: Re: String doesnt auto dup on modification 2009/1/22 Albert Schlef : > Stefan Lang wrote: >> 2009/1/21 RK Sentinel : >> > I define a string in one class. Some other class references it, and >> > modifies it. I (somehow) expected that when another referer modifies the >> > reference, ruby would automatically dup() the string. >> >> This is a well known "problem" with all languages that >> have mutable strings. The solution is simple: > > If I understand the OP correctly, his problem has nothing to do with > strings. Sorry, that's plain wrong. He explicitly mentions Strings in several places. The object that is mutated *is* a String. > He says he modifies some object ...and to his great surprise the object > indeed gets modified. :-) Cheers robert -- remember.guy do |as, often| as.you_can - without end