From: Robert Klemme Date: 2004-08-11T17:06:13+09:00 Subject: Re: string.each_char "Martin DeMello" schrieb im Newsbeitrag news:pdjSc.72120$J06.71567@pd7tw2no... > Gavin Sinclair wrote: > > > > Presumably you use this "compact" structure because it's one object > > rather than many? But then, each time you iterate it, you're > > generating #{string.length} temporary objects. Perhaps it would be > > more "compact" in the long run if you used an array of strings or > > symbols? Or a Set, depending on your access requirements. > > Hm - good point. We'd need to go down the C path and separate 'char' > from 'string', so that the former could be Fixnum-type singletons. Yet > another place where C thinking doesn't map to ruby best-practice :) Well, char and string *are* in fact separate. A char is simply a Fixnum. Although I'd prefer a unique type for chars that can be better deal with different encodings. IMHO the encoding issue is not fully satisfactory solved in Ruby yet. To improve this is one of my major requirements for Ruby 2. My 0.02 EUR... Kind regards robert