2007/9/6, Trans <transfire / gmail.com>: > > > On Sep 6, 5:10 am, Brian Candler <B.Cand... / pobox.com> wrote: > > > Rather, Symbol#to_s should return frozen String? > > > > Yes, as long as it returns the same frozen string each time. > > > > Hmm, this sounds like a good solution - it's technically not > > backwards-compatible, but I doubt that much code does a Symbol#to_s and > > later mutates it. > > I've tried that. There are some places where it blows up Ruby. So > those would have to be rooted out first. I always prefer less intrusive solutions. Why not do this: SYMS = Hash.new {|h,sy| h[sy]=sy.to_s} Then, wherever you need this, just do "SYMS[a_sym]" instead "a_sym.to_s". Added advantage, you can throw away or clear SYMS when you know you do not need it any more thusly freeing up memory. Kind regards robert