On Sat, 8 Oct 2005, David A. Black wrote:

> Hi --
>
> On Sat, 8 Oct 2005, Devin Mullins wrote:
>
>> David A. Black wrote:
>> 
>>> 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.
>> 
>> True, but the large majority of ! methods are simply in-place equivalents 
>> of their non-bang friends:
>
> [hundreds of lines of ri output snipped :-]
>
> Heavens -- I think we all knew that already :-)  There's one that I don't
> think you included: Tempfile#close! which closes and unlinks the file.
>
> One reason I think it's useful to remember the real meaning of ! is that
> gives one a potentially useful tool to use in one's own classes.  I don't
> know how many people actually write bang methods.  I've done it once or
> twice.

an interesting question, i seem to do it alot:

     jib:~/eg/ruby > find -name '*rb'|xargs -n1 egrep '^\s*def [^;(]+\!'|sort -u
         def add!
       def chop!
         def close!
       def close!
       def collect!
       def Complex.new!(a, b=0)
       def ConfigTable.get_entry!(name)
       def delete!(del)
       def diagonal!(val=1)
         def error!   #:nodoc:
       def escape! char, esc = 0x5c.chr
           def escape! s, char, esc
         def escape! s, char, esc
       def escape! s, char, esc
           def expand! string, opts = {}
     def expand! string, variables = {}
       def flatten!
           def free!
         def give_up!
           def give_up! label = 'attempt'
                     def indent!
           def maim!(pid, *sigs)
             def map!
           def map!
       def mask!(mask)
         def merge!(oth)
         def next! implementation_changed = true, interface_changed = false,  backwards_compatible = false
         def normalize!
       def order!(argv = ARGV, &nonopt)
         def order!(&blk) options.order!(self, &blk) end
       def parse!(argv = ARGV)
         def parse!() options.parse!(self) end
       def permute!(argv = ARGV)
         def permute!() options.permute!(self) end
       def Rational.new!(num, den = 1)
       def reject!
             def reject! &block
         def reject! &block
         def replace!(oth)
             def select!( ypath_str )
         def slice!(*args)
       def squeeze!(del=nil)
       def succ!
       def test_collect!
       def test_reject!
       def tr!(from, to)
       def tr_s!(from, to)
         def try_again!
           def try_again! label = 'attempt'
               def update!
             def update!
           def update!

although about 10% of those aren't mine and i seem to stick to a few common
names (update!) in that list.  still there are around 20 legit ones.

cheers.

-a
-- 
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| Your life dwells amoung the causes of death
| Like a lamp standing in a strong breeze.  --Nagarjuna
===============================================================================