From: Gary Wright on 20 Dec 2009 22:05
On Dec 20, 2009, at 11:03 AM, Benoit Daloze wrote:
> I don't think so, it became quite a mess when you did:
> Values: [1, :b, "cd"]
> 1.8: Values: 1bcd
> 1.9: Values: [1, :b, "cd"]
> I think the second shows better it's an Array.
A) making an incompatible change to something so basic as Array#to_s is/was a bad idea
B) Array#inspect was already available for debugging output
C) Array#to_s in 1.8 was useful for converting tree structures (nested arrays) to strings (in-order traversal).
> But I think that wasn't a way to do what you wanted. #to_s is made to show
> the result in a String, usually on screen. It's quite different than wanting
> to join every element with the following, what is the sense of #join.
It seems intuitive to me that the string representation of a list would simply be the concatenation of the string representation of the individual elements. If I wanted extra punctuation to aid in debugging then Array#inspect was always available and if I wanted to include separators of some sort I had Array#join. The advantage of Array#to_s vs Array#join (for null separators) is that it integrates quite nicely with string interpolation as well as many of the IO output primitives.