On Fri, Jan 20, 2012 at 8:19 PM, Yui NARUSE <naruse / airemix.jp> wrote:
> nil is not "", so there is no such documentation.

I don't understand your point.

To quote from array.c:

/*
 *  call-seq:
 *     ary.join(sep=$,)    -> str
 *
 *  Returns a string created by converting each element of the array to
 *  a string, separated by +sep+.
 *
 *     [ "a", "b", "c" ].join        #=> "abc"
 *     [ "a", "b", "c" ].join("-")   #=> "a-b-c"
 */

Clearly $, is documented as being the default. If that is not the
desired behavior, the documentation should be changed. I would
suggest:

/*
 *  call-seq:
 *     ary.join(sep=nil)    -> str
 *
 *  Returns a string created by converting each element of the array to
 *  a string, separated by +sep+. If +sep+ is nil, $, is used instead.
 *
 *     [ "a", "b", "c" ].join        #=> "abc"
 *     [ "a", "b", "c" ].join("-")   #=> "a-b-c"
 */

But I would prefer it to work as currently documented, because that
behavior is (slightly) less complex in that it doesn't require
explicitly specifying that "If +sep+ is nil, $, is used instead."