On May 15, 2007, at 10:53 AM, Brian Candler wrote: > On Tue, May 15, 2007 at 10:54:05PM +0900, Robert Dober wrote: >> On 5/15/07, Brian Candler <B.Candler / pobox.com> wrote: >> <snip> >>> But then what you want are not symbols, but true immutable >>> strings. By that >>> I mean: some object where I can write 10MB of binary dump. If I >>> want to add >>> one character to the end of it, then I create another object >>> containing >>> 10MB+1byte of binary dump, and the old 10MB object is garbage- >>> collected. >> But of course we have immutable strings already :))) >> >> class IString < String >> def initialize str >> super(str) >> freeze >> end >> end > > Yes, but it's not a singleton. You've stated or implied a couple of times in this discussion that symbols are 'singletons', but I thought the conventional definition of 'singleton' was of a class with only a single instance, where the instance is called a singleton. That doesn't describe Ruby's symbols. I think what you are getting at is the idea that identity and equality are one and the same for symbols. Fixnum instances also have this property but floats don't. Is there a standard term for that characteristic? I think in mathematics it would be an equivalence relation ~ such that If x ~ y then x = y for all x, y in the set. In this case ~ represents Ruby's == and = represents Ruby's equal?.