On Tue, Oct 17, 2006 at 05:14:09AM +0900, James Edward Gray II wrote:
> On Oct 16, 2006, at 3:06 PM, Rick DeNatale wrote:
> 
> >I'm curious as to why it's a good thing to make String nonenumerable
> >and remove String#each instead of just aliasing lines to each?  Are
> >there drawbacks which make it worthwhile breaking existing code?
> 
> Well, now that we're stepping into the M17N world it no longer makes  
> sense to work with Strings until we specify a unit for the content.   
> Each what?  Each character, line, or byte?
> 
> I really think this is a good move.  Every book that introduces  
> String#each says something like, "You probably don't expect this, but  
> Strings iterate over lines..." 

And there's also $/ to make things less obvious:

$/ = "."
a = "foo.bar.baz"
a.each do |x|
 x                         # => "foo.", "bar.", "baz"
end

-- 
Mauricio Fernandez  -   http://eigenclass.org   -  singular Ruby