From: Mark Wilson Date: 2003-11-20T11:14:29+09:00 Subject: Re: x.f! RCR On Nov 19, 2003, at 12:43 PM, Dan Doel wrote: [snip] > That depends on your background, I suppose. If I'm not mistaken, ! > and ? probably come from Scheme, > where ! is usually used to denote that it causes a side effect on the > arguments. [snip] My understanding of the use of ! in Scheme (and Lisp) is that ! is used for functions that serve as assignments (in the sense of creating state in the environment). In Ruby, by a mostly perfect analogy, ! is appended to methods that modify in place the value of an object, where the use of ! would not be duplicative (i.e., delete! would be duplicative). Frequently, in Ruby there will be two methods that do the same thing (such as slice and slice!) except that one modifies the object in place. The main point of ? and ! is solely directed to enhancing the ability of people to understand a program they are reading. In light of this, any actual or supposed inconsistencies should be raised and actual inconsistencies should be eliminated. I think the core library is consistent now. It is easier to determine when to use ? than it is to decide that a particular method needs an appended !. In general, I think it is best to use ! to differentiate between two versions of what is, functionally, a single method and to not use ! where state is not changed or where only a modify in place method is appropriate. Regards, Mark