From: Nikolai Weibull Date: 2005-10-31T07:46:54+09:00 Subject: Re: characters (and small strings) in ruby 2.0 Eric Mahurin wrote: > In ruby 2.0, the current plan is to for a character to be represented > as a String instead of an Integer. I'm writing a parser/lexer and I > think not representing characters as immediate objects could be a > significant performance penalty. Could I suggest something? How about > a character be represented as frozen/immutable string and give very > small (maybe up to 3 8-bit chars for 32-bit and 7 8-bit chars for > 64-bit) immutable/frozen strings an immediate class (like a small > Integer is a Fixnum)? So for most character encodings any character > could be an immediate, but when necessary a normal String-like (frozen > or immutable) object is used to encode the character (like Bignum's > are used when you go over the Fixnum limit). So you want to have flyweights for character strings. It sounds as if your suggestion would be a lot easier to realize if all strings in ruby were immutable. Still, I kind of like this idea, but I have no idea if it���s feasible or if it���s even a good solution. nikolai -- Nikolai Weibull: now available free of charge at http://bitwi.se/! Born in Chicago, IL USA; currently residing in Gothenburg, Sweden. main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}