From: "Florian Groß" Date: 2005-09-09T00:49:21+09:00 Subject: Re: returning strings from methods/instance_methods TRANS wrote: > I was just wondering why with #methods and #instance_methods, it was > decided to return the names as strings and not symobols? I'm working > on something right now that uses those, building a hash, and it just > stikes me as odd when in so many cases the common idiom is to use a > symbol, (eg. attr :x, define_method :x, etc.) Arn't symbols > substantially lighter weight, which is why we generally have them at > all? Take this with a grain of salt as I was not around back then: I think Ruby used to return a Fixnum for :foo in the past meaning that #methods and #instance_methods had the choice of returning a bunch of numbers that have no meaning for humans or to return strings. I guess there wasn't a good enough reason for converting it to symbols when the Symbol class was introduced and thus it was decided that breaking backwards compatibility would not be a good idea. I'm inferring that Ruby once used Fixnums instead of Symbols because of this: irb(main):010:0> 5.send(:+.to_i, 5) (irb):10: warning: do not use Fixnums as Symbols => 10 Feel free to correct me and/or add more information. I'm personally interested in Ruby's past so corrections or additions are very welcome.