* <dblack / rubypal.com> (13:48) schrieb:

>> That's because of the completeness of the library. Whenever there can be
>> a non-modifying partner, there is one.
>
> ! does not mean modifying; it means "dangerous".

Most methods flagged with a ! are dangerous because they modify their
receiver.

>> When you just define a modifying method, is not right to name it without
>> a ! just because you choose not to define a non-modifying version.
>
> I would never add a ! to a method name solely because it changes the
> receiver. That's a re-invention of what ! is for.

No, you add it because someone might else assume it is a non-modifying
method, that is what makes it dangerous.

Array#pop is modifying but not dangerous, because everyone expects it to
be modifying.

>> What if some other developer wants to add the non-modifying version?
>> He would have to rename your version.
>
> I think that's a solution in search of a problem.

No, that's a problem.

> Just name your methods clearly, without !. Then, if you (or someone
> else) want to add a "dangerous" version, you can write the ! method.

You are the one who's proposing that something isn't dangerous because
there currently isn't a less dangerous version.

mfg,                       simon .... l