Hello --

On Mon, 12 Mar 2001, Paul Pladijs wrote:

> To me, Ruby does not seem very consistent in the use of function suffix
> punctuation. Some examples:
> 
>   Array#clear
>   Array#pop
>   Array#replace
>   
> Althought it's a destructive method, I don't see any '!' suffix! You could
> argue if it's always necessary to add a suffix? E.g. calling IO#read does
> change the (internal) state of the IO-object, but this seems normal. Even 
> stronger, we expect this kind of behaviour. This also applies to Array#pop 
> and Array#push. These are basic stack operations where the behaviour is
> known to every (trained) programmer.

As you suggest, the fact that a method alters its receiver does not mean
we'd want a !.  Otherwise we'd end up with []=! :-)

But I don't agree that Ruby is inconsistent here.  It's possible to adopt
a different philosophy about how to name methods, but as far as I know,
Ruby is absolutely consistent in following the philosophy it uses.
Every method which ends in ! is an inplace/destructive method *and*
has a corresponding non-destructive method, with no !.


David

--  
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav