From: Gavin Sinclair Date: 2002-11-03T21:12:37+09:00 Subject: Re: Thoughts on Ruby From: "Albert Wagner" > > [Enric:] > > Why are Strings arrays of integers ? aString[0] is an integer, yes, it's > > the way it is, but I would like to have String as an array of chars, and > > char if you want as a descendant of Integer (nice election because a > > Unicode String is and array of double chars i.e. integer), I don't know > > you, but for me aString[i].chr =='x' is somewhat unnatural, because it > > breaks the semantic of a String, so it's not intuitive for me. > > It is not intuitive to many people. There have been long discussions on the > pros and cons. > It's probably not intuitive to *anybody* (except perhaps Matz). However, I see no particular justification for it being any other way, and in fact it's changing in 1.7 isn't it? Anyway, my point is: you'll never forget it now. And if you're like me, you won't care either. But to nitpick, a String is *not* an array of integers. It is a String :) Other options, if you're testing equality of an individual character: string[i] == ?x string[i,1] == "x" Cheers, Gavin