Hi,
In message "[ruby-talk:6605] Re: Question on sort!"
on 00/11/29, Dave Thomas <Dave / thomases.com> writes:
|> (+) consistency.
|> (-) returning nil somtimes breaks method chains.
|>
|> The latter can be avoided if one follows the no-bang-method-chain
|> rule. But I don't force you to agree with me (yet ;-).
|
|There's another way to view consistency: sort and sort! might be
|expected to return the same type of thing.
I don't call it consistency, but I have to admit that returning nil is
not much useful for several methods, namely sort! and reverse!.
Even though I still recommend the no-bang-chain rule, making sort! and
reverse! return the receiver always might be suitable for POLS.
matz.