From: Gary Wright Date: 2007-02-15T05:22:37+09:00 Subject: Re: Justification for Array#join behaviour? On Feb 14, 2007, at 2:52 AM, Farrel Lifson wrote: > What is the justification for [1,2,[3,4]].join(',') being '1,2,3,4' > instead of '1,2,34'? According to ruby-doc.org join "Returns a string > created by converting each element of the array to a string, separated > by sep.". Why should an element be recursively joined if it's also an > array? Be aware that Array#to_s has changed in Ruby 1.9 $ irb-1.9 irb(main):001:0> a = [1,2,[3,4]] => [1, 2, [3, 4]] irb(main):002:0> a.to_s => "[1, 2, [3, 4]]" irb(main):003:0> a.join => "1234" irb(main):004:0> The issue is that Array#to_s defers to Array#inspect in 1.9 instead of simply concatenating the results of #to_s on all the elements. I didn't expect this change either and matz pointed me to Array#join Check out this thread: ruby-talk:220698 Gary Wright