From: Ammar Ali Date: 2010-10-19T00:20:45+09:00 Subject: Re: Is it possible to find out if an identifier is a method alias? On Mon, Oct 18, 2010 at 5:56 PM, Robert Dober wrote: > Maybe it is best to say that somehow it really does not matter, I > would be curious to see where it matters. The following, completely > useless code,  somehow demonstrates this: > > Class::new do >  def a; end >  alias_method :x, :a >  remove_method :a >  alias_method :a, :x >  p instance_methods( false ) > end > > and the question I would like to ask is, what is :a in this case? An > alias to itself after having been removed I guess ;). If I understand how this works correctly, then remove_method is only removing the :a entry for the method from the object's table, but since there is another "reference" to the method definition (the b alias, which is just another entry to same method), the body of the method is not removed. Adding :a again is simply adding a new entry for the same method. If both :a and :b are removed, then one tries to add an alias a NameError would be raised. Regards, Ammar