* Gavin Kistner (Mar 19, 2005 19:11):
> > I ranted about this very behavior 2 days ago. I'm willing to do an
> > RCR if anyone agrees (hint, hint).

> > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/133894

> I experience the same pain, and would vote for such an RCR

Exactly when do you experience this pain?  Perhaps you need some
aspirin?

Seriously, if you think using bang-methods is painful, I'd suggest not
using them at all.  Use non-destructive methods instead.  The
tradeoff in speed is negligible for anyting but real large
iteration-counts, e.g., in the area of perhaps five million and beyond.
At that point, it'd probably be better to come up with some special
method for doing what you're trying to do (although on my machine doing
one million

        line.strip.downcase

takes 1.7 seconds (the banged version takes 1.2 seconds), so I'm not
really worried, I'd be more worried with how I'd store the result if
that's what the task is.  (Actually, I'm guessing a large portion of
those 0.5 seconds are due to the garbage collector being invoked for the
non-banged one, but please remember that it's only a guess.)

I'd like to propose an RCR that would abolish the destructive versions
of methods in String and other standard classes.  They're simply too
confusing (discussions such as these prove me right) and their uses,
if any, are usually symptoms of code that should be written differently.

I'm only half serious, but please realize that those methods are
suffixed by a bang for a very good reason,
        nikolai

P.S.
It's strange, but the more I work with Ruby, the more I realize how
beautiful languages like Haskell and Clean really are.  There are good
reasons for having languages free of side-effects.  Still, I'd rather
program Ruby than spend my time wrestling a type-system that makes my
head spin.

Remember: the great thing about dynamic languages is not that you don't
have to write type-declarations, it's that you can write anything you
like for all the parts of the system that never get run!
D.S.

-- 
::: name: Nikolai Weibull    :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA    :: loc atm: Gothenburg, Sweden    :::
::: page: minimalistic.org   :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}