From: Dave Thomas Date: 2000-12-25T00:30:15+09:00 Subject: [ruby-talk:8041] Re: Basic hash question ts writes: > D> string is used as a hash key, it is copied automatically, so that > D> subsequent changes to the string don't affect the hash. > > copy-on-write, like regexp a = "hello" h = { a => 1 } b = h.keys[0] a.id # => 537675084 b.id # => 537675424 a = "hello".freeze h = { a => 1 } b = h.keys[0] a.id # => 537675074 b.id # => 537675074 Seems to copy on insert unless the original is frozen. Dave