Hal Fulton wrote: > Trans wrote: > > So in a way you are right, it is a kind of two-way inheritance. And if > > you think about the orgins of Symbol one can more understand why. > > Symbols did not originally exit in Ruby. They were added later as a > > light-weight substitute for Strings. So indeed their very existance is > > one intended to easily interchange depeding on the usage. > > When were symbols introduced? I think it was quite some time ago. > Definitely a 20th-century feature. Ruby 1.6.0 introduced Symbols in a stable release. > Who described them as a "lightweight substitute for strings"? Symbols are more lightweight objects than strings, since they are immediates like fixnums. matz. > >>I think there's a somewhat exaggerated sense of the speed-up factor > >>involved in symbols sometimes. > > > > That may be the case, but then why have symbols? > > They're immutable. They're easier to type. They're singletons in a > sense, so they save memory. All good (and lightweight) reasons. T.