From: Rob Rypka Date: 2005-10-08T09:25:31+09:00 Subject: Re: select! not present but reject! is You had to reply, didn't you... On 10/7/05, David A. Black wrote: > I hadn't thought we were talking about them. They seem OK to me, > though I could imagine reject actually being an in-place operation > even without the !. I had tried (and failed) to make this point earlier. > The ! doesn't mean that a method modifies the receiver in place, > though, but rather that this is a "dangerous" version of the method > and should be used carefully. The "danger" often has to do with > in-place change, but ! itself doesn't mean that. I stand (somewhat) corrected. I had assumed some things based on Pickaxe and my own delusional perspective into this world. Before now, I had never been able to find information on the bang, because I hadn't yet reduced my search results to replies from Matz. Here's the relevant quote from [ruby-talk:02331]: "Unlike Scheme, not all change-in-place functions are named with exclamation mark. In Ruby, exclamation mark means `MORE dangerous', or `may cause surprise' than non-bang counterpart, i.g. in-place modification by `gsub!' may let you surprise, comparing copying `gsub'." I'm not trying to be mean by nit-picking a non-native speaker's English, I'd like some clarification. I knew that methods existed that modified the object without !, but their names were pretty clear (e.g., delete_if). I thought the ! was there to imply modification of the receiver, which could lead to unexpected results if used on a function argument. Are there any ! methods that don't modify the receiver? Are there any ! methods that do not have normal "non-dangerous" counterparts? I can't think of anything that would not modify the object, but be considered "dangerous," unless it's going to cause your sysadmin to come to your office and beat you with a shovel. Then again, the proposed select! seems to have caused you surprise, so I think the name still fits :-) I think select! is the right name for a proposed companion to reject!, but others don't, so I'm open. It's funny how I seem to argue most about things that don't really matter to me (like the name of this method). -- Rob