From: "Michael W. Ryder" <_mwryder@...> Date: 2007-04-24T17:35:06+09:00 Subject: Re: Question regarding design of the String Class Lee wrote: > You know, you can always type: > > s = 'Hello World' > puts s[1,s.length - 1] > > Maybe that's a bit wordy for you? I think Ruby's use of [] really > follows convention that you are accessing an index. That is what most > programmers think of when they see []. If you provide a single > Fixnum, one would expect you would get back the contents of that > index, and since strings are arrays of characters, that is what you > are indeed getting back. > If I were getting back a character or string I would not have a problem. The problem is that every other use of [] in the string class returns a string or nil, this one returns an integer. I was curious if this was necessary for some other part of the language or just an "accident".