From: SASADA Koichi [mailto:ko1@atdot.net]
Sent: Monday, July 18, 2005 8:40 AM
To: ruby-talk ML
Subject: ruby-dev summary 26385-26467
<snip>
NARUSE, Yui proposed that Ruby HEAD should include following
functions.1) String#each_byte (without block) #=> Array
It's same function as "'string'.unpack('C*')".
2) String#each_char (without block) #=> Array
3) String#each_char (with block) #=> str
String#each_char is same as "'string'.split(//).each".Matz rejected (1) and (2), because it's not feature for
"each". He agreed to import these method if there are any
suitable name.
What about simply altering String#to_a?
String#to_a(bytes=false)
Returns the string as an array of characters, or bytes if the +bytes+
argument is true.
I've never really liked the current implementation, where "foo".to_a
merely becomes ["foo"] - it just isn't useful usually. However, I'm
also aware that modifying String#to_a could cause major breakage for
many current packages (mine included). Is it worth it? I'll let Matz
decide.
Regards,
Dan
···
-----Original Message-----