From: "David A. Black" Date: 2007-02-26T06:51:36+09:00 Subject: Re: Any way to undef a constant? Hi -- On 2/25/07, Bill Kelly wrote: > From: "Patrick Hurley" > > On 2/23/07, Bill Kelly wrote: > >> Auuugh!!! How did I miss that !!!!!!!!!!!!!!!!!!!!!!! :D > > > > You are not the first, I think it is the naming convention. We have > > constants, const_get, const_set and remove_const (reversed naming). > > In my case it was "undef" vs. "remove". I was used to > undef_method. So I did `ri undef`, and got: > > Module#method_undefined, Module#undef_method, > Object#singleton_method_undefined, ObjectSpace#undefine_finalizer > > So there appeared to be no undef_constant. However, once you pointed > me to remove_const, I can see we have a much richer set of remove_ > methods, only about half of which have undef_ aliases. > > Module#method_removed Module#method_undefined > Module#remove_class_variable > Module#remove_const > Module#remove_method Module#undef_method > Object#remove_instance_variable > Object#singleton_method_removed Object#singleton_method_undefined > ObjectSpace#remove_finalizer ObjectSpace#undefine_finalizer > > > From my point of view, it would be nice to add the three > missing _undef aliases. (Is that worthy of an RCR ?) They're not aliases, though. See ri undef_method for illustration of the difference between undef_method and remove_method. David -- Q. What is THE Ruby book for Rails developers? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf) Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.com)