ts <decoux / moulon.inra.fr> writes: > >>>>> "D" == Dave Thomas <Dave / PragmaticProgrammer.com> writes: > > >> copy-on-write, like regexp > > D> a.id # => 537675084 > D> b.id # => 537675424 > > See rb_str_new4(), you have 2 differents objects which reference the same > C string (like for regexp) I understand that, Guy. But we're not talking underlying implementation here (because we hope it's transparent to the user). The difference between strings and other objects wrt. hashes is that the string (object) is copied when it is inserted in to the hash, while other objects aren't: r = 1..10 h = { r => 1 } r.id # => 537675074 h.keys[0].id # => 537675074 s = "Hello" h = { s => 1 } s.id # => 537670764 h.keys[0].id # => 537671104 That's a significant user-level difference. Dave