Is there anyway to "probe" a method in common lisp
My application allows the user to create their own methods in开发者_开发知识库directly and I later need to refer to these methods. I am wondering if there is a way (for error checking purposes) to test if a method exists without trying to execute it. If I just try and call the method and it doesn't exist this will crash my application.
Also see the function FIND-METHOD : http://www.lispworks.com/documentation/HyperSpec/Body/f_find_m.htm#find-method
It will not really crash, but signal a condition. If this condition is not handled, the debugger will be entered. See the CLHS, Section 9.1, for information on how to use the condition system.
Anyway, you can simply use fboundp
for checking.
One solution would be to provide a "do nothing" GF method, dispatching on class T (the superclass of all classes). You'd need this for all GFs you're implementing methods on. It would also be possible to have that "do nothing" method log some data, maybe the class of each argument, for audit purposes.
精彩评论