In RCR 277 it is proposed to have def return something useful, more
specifically the symbol under which the method is defined. Something like
this has been proposed/requested a few times on ruby-talk too (dating back
as far as 2001 [ruby-talk:15434]).
At https://developer.berlios.de/project/showfiles.php?group_id=1216&release_id=4105
you can find a patch that implements the idea but returns an UnboundMethod
instead of a symbol (or a Method when defining a singleton method). It
extends Module#public/private/protected to take a single (Unbound)?Method
as parameter. The patch is against the source of Ruby 1.8.2.
I'm still in the dark about the true speed hit of this change, as it
actually seems to run slightly faster on my machine, or at least for the
few tests I've conducted.
Disclaimer: the existence of this patch does not reflect whether or not
I'm in favor of actually having this in Ruby. I'm just building these
things because that is the best way for me to learn about Ruby's 'guts'.
Peter