From: Ryan Leavengood Date: 2005-07-19T00:58:20+09:00 Subject: Re: ruby-dev summary 26385-26467 Berger, Daniel said: > > 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 *strongly* dislike parameterizing methods like this. If you are going to fundamentally alter the behavior of a method, just make a new method. That way the new behavior is explicit. If I read this code: "str".to_a(true) I will probably have to read the documentation for to_a to figure out what the true means. Whereas this: "str".to_bytes # Or whatever it is called is essentially self-documenting. > 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. The usefulness of the current String#to_a is certainly debateable, but changing it is definitely too big of a change to be viable. Ryan