From: Ryan Leavengood Date: 2005-11-19T13:00:04+09:00 Subject: Re: Symbol#inspect bug? On 11/18/05, Eric Mahurin wrote: > > For many of the other core classes (and definitely all other immediate > classes), #inspect returns a representation that is eval'able to get > back an equivalent (or the same) object. When possible, I think that > is what #inspect should do. I think it is a bug that Symbol#inspect > almost does it, but not quite (quotes some cases but not others). I agree this should be fixed. I wrote something that I think shows all the problem cases (at least for single characters): 32.upto(126) do |i| c = i.chr s = ":\"#{c}\"" if c == "\"" or c == "\\" s = ":\"\\#{c}\"" end symbol = eval(s) begin symbol = eval(symbol.inspect) rescue SyntaxError puts "Failed to eval inspected form of #{s}" end end The results: Failed to eval inspected form of :"!" Failed to eval inspected form of :"0" Failed to eval inspected form of :"1" Failed to eval inspected form of :"2" Failed to eval inspected form of :"3" Failed to eval inspected form of :"4" Failed to eval inspected form of :"5" Failed to eval inspected form of :"6" Failed to eval inspected form of :"7" Failed to eval inspected form of :"8" Failed to eval inspected form of :"9" Failed to eval inspected form of :"=" Failed to eval inspected form of :"@" Ryan