[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting hold of the method object currently executed

In Victoria Day PCL, is it possible, from the body of a method, to
reference the method object itself?

I could use something like

(get-method generic-function () (mapcar 'find-class arglist))

but that seems to be a waste of time since, being in the body of a method,
it is obvious that the proper method has just been looked up.
I guess I am more or less looking for a special variable that could
be named *current-method* and that this variable would be bound by the
generic dispatch mechanism.

I tried looking for the call-method macro, but it doesn't seem to exist
in Victoria Day PCL; the name is used, but the code is a bit too complex
for a neophyte like me.

I also thought of using a defadvice on get-method, to cache the return
value, but it seems that some other mechanism (in dcode.lisp?) is
used from within generic functions.

I am willing to modify the PCL sources if somebody can give me pointers;
this is really important for my application, and getting a bit pressing.

Thanks a lot,