From: "Bartosz DziewoƄski" Date: 2012-09-26T05:06:37+09:00 Subject: Re: could initialize return an existing object instead of a new instance? 2012/9/25 Gary Weaver : > Specifically curious about whether it would be possible to implement a > StringPool in Ruby such that the same object with same object_id would > be returned if you tried to construct with the same value, unless a bang > method (like chomp!) were called on the object in which case instead of > returning the same object instance from the bang method, it would return > a different object instance. I told someone that this would be a massive > change since it would break these two assumptions: Is that an academic discussion or an attempt for practical optimization? Because Ruby sorta kinda does this internally. http://patshaughnessy.net/2012/1/4/never-create-ruby-strings-longer-than-23-characters http://patshaughnessy.net/2012/1/18/seeing-double-how-ruby-shares-string-values -- Matma Rex