On Tue 22 Feb 2005 at 09:10:44 +0900, Hal Fulton wrote:

> This is in contrast to the fact that certain bang methods sometimes
> return nil -- that behavior I've also seen justified, and can easily
> imagine use cases, but I still have never liked it. It's one of my
> most common bugs, personally. And not once have I ever *wanted* the
> "return nil" behavior.

I've occasionally found this to be useful, in constructs such as:

unless url.sub!( %r(^file://), '' )
  raise "Invalid file URL: #{url}"
end

Here, the combination of performing the substitution and checking
whether it actually happened is quite useful.

Ian
-- 
Ian Macdonald               | Documentation is like sex: when it is good,
System Administrator        | it is very, very good; and when it is bad, 
ian / caliban.org             | it is better than nothing.   -- Dick
http://www.caliban.org      | Brandon 
                            |