From: "Hal E. Fulton" Date: 2002-07-06T03:31:01+09:00 Subject: Re: is there a better string.each? ----- Original Message ----- From: "Michael Campbell" To: "ruby-talk ML" Sent: Friday, July 05, 2002 11:07 AM Subject: Re: is there a better string.each? > > This is something which bites everybody, I think, at some point. > > Not to be a pedant, but this seems like a huge breakage of the POLS, > if it bites everyone, no? =) I see your point, but I disagree. If Ruby behaved identically to C, then the surprise for C programmers would be precisely zero. But when you use C for string processing (especially when you've used something more powerful), you find yourself saying: "There should be some easy way to do THIS..." In the first place, POLS is a Matz-centric phenomenon (as he has admitted). The more you think like Matz, the better you will understand Ruby. Secondly, POLS should be a meta-linguistic issue IMO -- not "how does this work in my favorite language?" but "how *should* this work in an ideal universe?" And I think Strings are not really Arrays. There are some isomorphisms there, since they are both "ordered collections of entities." But a string is a highly specialized thing. For one thing, each item has to be a character. No other Ruby array is limited in the kind of data it can contain; such an idea seems very unRubylike to me. No, I have to say that in this respect as in others, Ruby corrected C's mistake. And it was not really and truly a mistake in C; C is close to assembly language, and is not as high level as Ruby. There was not really another way to think of strings except as arrays. But we're past that now. Hal Fulton