Is there anyway to “probe” a method in common lisp?

Also see the function FIND-METHOD : lispworks.com/documentation/HyperSpec/Bo....

Up vote 1 down vote favorite share g+ share fb share tw.

My application allows the user to create their own methods indirectly 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.

Common-lisp link|improve this question asked Jun 10 '10 at 22:50Mike2012980936 77% accept rate.

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.

That's great thank you! Is there anyway to dissect the method returned by fboundp to determine what the class of the expected caller is supposed to be? – Mike2012 Jun 11 '10 at 19:52 fboundp returns a generalized boolean, indicating whether a function of that name exists (I may have misinterpreted the intent of your question).

The "class of the expected caller" is irrelevant; I guess you mean the specializers for the method. See Rainer's answer for that (using find-method). – Svante Jun 11 '10 at 20:09.

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.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions