From: dblack@... Date: 2006-03-21T22:16:32+09:00 Subject: Re: iterate chars in a string Hi -- On Tue, 21 Mar 2006, Trans wrote: > Modifying String#to_a to return an array of characters has been > brought > up before (ruby-talk:148588 and following). I don't think Matz likes > the idea, though. > > It should be pointed out that there really is a flaw in the way Ruby > handles this. #each takes a parameter which defaults to the global > variable $/ to determine the actual split to perform. Not only can't > enumerable handle the parameter, but worse relying on a globabl > varaible like that is dangerous! To be safe one would have to set the > global everytime it is used, or aways give the parameter. Otherwise > another lib might change it on you. The upshot of all this is that we > are much less inclined to even bother with String#each, which is too > bad. Another lib might change *anything* on you :-) We all have to trust each other not to do that. David -- David A. Black (dblack@wobblini.net) Ruby Power and Light, LLC (http://www.rubypowerandlight.com) "Ruby for Rails" chapters now available from Manning Early Access Program! http://www.manning.com/books/black