Neil Hodgson <[EMAIL PROTECTED]> wrote: > Magnus Lycka: > > > Except when it isn't obvious. What constitutes mutation of an object? > > C++ handles this with 'const', and lets the programmer cheat by using > > transient member variables, since there are cases when you actually > > want to mutate objects a little, but claim that you don't... > > Ruby uses '!' not for mutation but to indicate surprising or > destructive mutation. If it was placed on all mutators, code would be > full of '!'s. '!' is less common on methods that modify the receiver > than on methods that mutate other arguments.
Thanks for the clarification! Unfortunately, this variation on the convention does make it substantially less clear/sharp/well-defined, and therefore less useful; whenever I call a mutator I must memorize or work out (or guess) whether the author considered its mutation "surprising or destructive" to know whether I need to append a bang or not, which is peeving; so, I'm now happily reconciled to Python never adopting this. Alex -- http://mail.python.org/mailman/listinfo/python-list