> -----Original Message-----
> From: James Edward Gray II [mailto:james / grayproductions.net] 
> Sent: Monday, October 16, 2006 2:14 PM
> To: ruby-core / ruby-lang.org
> Subject: Re: Symbol < String in Ruby > 1.8
> 
> 
> 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..."  Now it will always be crystal clear:
> 
>    my_str.chars.each { ... }

I sometimes write methods that take a string or an array of strings and,
internally, I don't have to check the type - I can just call .each, and
it will do the right thing:

def foo(arg)
   arg.each{ |x| ... } # string or array, either will do
end

I'm not saying this is a compelling reason to keep String#each (or to
keep the behavior of String#each the same, even if there is a
String#each).  I'm just pointing out an added nuisance this will bring
in practice.

Regards,

Dan


This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly 
prohibited and may be unlawful.  If you have received this communication 
in error, please immediately notify the sender by reply e-mail and destroy 
all copies of the communication and any attachments.