I was hoping for something other than that. I like to maintain forward
compatibility.

Of course some of this process could be automated by cycling through the
methods and aliasing and redefining methods that end in !, but this wouldn't
work for << or other methods that don't have the !.

--
John Long
www.wiseheartdesign.com


----- Original Message -----
From: "Dan Doel" <djd15 / po.cwru.edu>
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
Sent: Monday, February 02, 2004 2:44 PM
Subject: Re: Destructive String Methods


> Well, here -- http://www.rubycentral.com/ref/ref_c_string.html -- is
> the reference for the Ruby String class.
>
> The first thing that comes to mind is going through the list, finding
> destructive methods, and overriding them in your subclass with a call
> to some update function, like so:
>
> class String
>     def chop!
>        super
>
>        update
>     end
>
>     # ...
>
>     def update
>        # invalidate the cache somehow
>     end
>
>     # ...
> end
>
> - Dan
>
>
>
>