I thought about it but it was inconvenient. The key is that
one has to always remember this side effect in order not to make the mistake
no matter what one would do.
From POP3 Tue Jul 16 16:50:55 EDT 2002
Date: Wed, 17 Jul 2002 05:49:40 +0900
Posted: Tue, 16 Jul 2002 13:51:15 -0700
From: Joel VanderWerf vjoel@PATH.Berkeley.EDU
Subject: Re: alias_method problem
To: firstname.lastname@example.org (ruby-talk ML)
X-MLServer: fml [fml 3.0pl#17]; post only (anyone can post)
X-ML-Info: If you have a question, send e-mail with the body
"help" (without quotes) to the address email@example.com;
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529
X-Accept-Language: en-us, en
X-Virus-Scanned: by amavisd-milter (http://amavis.org/)
But if for some reason the class is reloaded, The “oldone” will
point to the “newone” that is defined as above(calling the “oldone”)
instead of the originally defined one.
Calling “newone” after the reloading ends up with stack overflow.
I assume this had been brought up before. Any fix or workaround?
It was discussed starting at:
What about putting the alias operation in a different file from the rest
of the class def?
=== A-alias.rb ===
=== A.rb ===
This way, you can always reload A.rb without re-aliasing.