On Sun, 17 Jun 2001, Robert Feldt wrote:
> If there is no simple way shouldn't we add the klass id to method_added:
>   method_added(methodId, klassId)

If your "id" here is Symbol, then I say a Symbol is not enough to identify
a class. Not all classes are in the root namespace (Object) and not all
classes even have a name. So you probably want the class object itself
instead.

The class (or module) object, in that context, is called "self".



> ? RCR? Or one can easily get it from 'caller' as in my previously
> proposed call_stack RCR...

Not sure how you'd do that... I don't think "def" will appear in the
call stack. I expect something weird to happen, like a half-blank
entry or a missing entry or two half-missing entries (e.g. Ruby code
appears to be calling method_added itself...) but that's pure speculation.



> I sure hope this is already supported in some way I've missed...

I have played a bit with #method_added a few weeks ago...

def Integer.method_added(sym)
	if sym==:%
		puts "I find your lack of faith... disturbing"
		Process.kill 11, Process.pid
	end
end

but then, Hurst and I figured out that:

a. #method_added can be redefined or removed without your #method_added
being actually called.

b. unless you freeze Module ;-)

c. doesn't prevent anyone from def'ing a singleton #method_added without
you getting to know anything about it. 

d. you still don't have info about the replaced method...

sorry, haven't pushed this further.

matju