From: Nikolai Weibull Date: 2005-06-02T09:13:41+09:00 Subject: Re: Method Chaining Issues Kyle Heon wrote: > > > Some people think that "bang" methods shouldn't exist at all! > I'm new to Ruby so I when you refer to a "bang" method you mean > something like "chomp!"? And if so, why do some thing they shouldn't > exist? Just curious. Because they alter the value of the object that they are invoked upon. For many data objects, modification of the object itself is precisely what you want, but for, for example, strings, this is most often not the case. Bang methods cause more confusion than they are worth, as has been shown over and over on this list. I have no problem with Hash#delete, mind you, but String#gsub! can easily be substituted by String#gsub without worrying about time penalties. And for cases where you might worry, you shouldn’t be using a String in the first place. Bang methods are often a sign of premature optimization, which is often considered the number one no-no in programming, nikolai (who’s sure that other people’ll fill in the other arguments…for and against) -- Nikolai Weibull: now available free of charge at http://bitwi.se/! Born in Chicago, IL USA; currently residing in Gothenburg, Sweden. main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}