From: Bertram Scharpf Date: 2007-02-15T03:49:42+09:00 Subject: Re: Justification for Array#join behaviour? Hi, Am Mittwoch, 14. Feb 2007, 16:52:00 +0900 schrieb Farrel Lifson: > 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? You would have to ask for the objects type: class Array def deep_join sep map { |x| case x when Array then x.deep_join sep else x.to_s end }.join sep end end I don't look at this as a smart programming style actually. The object-oriented approach is to redefine `to_s'. Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de