From: Sean Russell Date: 2002-07-09T13:05:34+09:00 Subject: Re: is there a better string.each? -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Yukihiro Matsumoto wrote: > |Since there doesn't seem to be a universally happy medium, perhaps the > |problem lies in assuming there is one. I think the method "each" is the > |problem: it's ambiguous ("each what?"). > > If the name "each" is the problem, it is the problem that costs just a > few bits in your brain, so it's virtually nothing at all. I'm sorry. I've forgotten who originally suggested this, but the best solution I've seen so far is allowing $/ = '', whereby String::each would use the invisible space between characters as the boundry for itteration. This would require no change in current behavior, and while new Ruby users will continue to be bitten by the default String::each behavior, at least there'll be a sensible solution to the obviously significant need to itterate over characters. I say "obviously" because there seem to be a number of people in this discussion who want that functionality. In the end, I don't know if this would be faster than using String::split(''), but it would probably be more intuitive. - --- SER -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9KlxMP0KxygnleI8RAtljAJ9u2Wswhg+/029OqfxouT2xYa2CRACgs1Jb VwDTe9RT/8ivrGLazUmGJbo= =IiHY -----END PGP SIGNATURE-----