Hi,

In message "[ruby-talk:04004] Re: Array.uniq! returning nil"
    on 00/07/14, Aleksi Niemel<aleksi.niemela / cinnober.com> writes:

|Still I don't know if the fact that method! can return nil was just
|introduced when needed (as someone pulled in some code to show it in this
|thread), and the current functionality remains because there's loads of code
|relying on it, or whether it was thought, and decided, to be inconsistent
|with the principle I just phrased. (Perhaps because Ruby is following here
|some other clean and simple priciple.)

Actually, it is mainly a historical reason.

In old days, non bang methods returns copy if modified, and original
if not modified.  So you could distinguish whether modify is done by
comparing the return value with the original object.  But bang method
could not provide the way to know if modified or not.  That was why I
made bang methods to return nil if not modified the object.

But later, non bang behavior was changed to return copy always, to
avoid copy/original confusion.  But I still expected the need to check
modification, so changing bang behavior was abandoned.

							matz.