On Sun, 7 Jul 2002 11:14:52 +0900, Dossy wrote:
> On 2002.07.07, Tom Sawyer <transami / transami.net> wrote:
> I don't know Matz very well, but perhaps the reason why
> String#each iterates over whole newline-terminated strings is
> because you're asking for "each String" ... and a string isn't a
> character, it's a sequence of characters -- in Matz's least
> surprise, a sequence of characters terminated by a newline.

Minor correction, here -- terminated by a record separator, not a
newline. $/ is by default the same as \n, but String#each doesn't
have to split on newlines, and can in fact do the same as /\n+/m.
Earlier, I was wondering why $/ can't be a regex OR a string (where
the string results in a regex of /<string-val>/ -- and I still
wonder that it might not be a bad idea for $/ to be so.

I agree with you on String#characters (with an alias of
String#chars) -- it would be satisfy both views of strings, IMO.

-austin
-- Austin Ziegler, austin / halostatue.ca on 2002.07.06 at 22.42.57