* Tobias C. Rittweiler [2008-02-24 21:06+0100] writes:
Helmut Eller heller@common-lisp.net writes:
Yes, that's a useful application. I don't quite understand how FIND-DEFINITIONS can be used here because FIND-DEFINITIONS expects a (generalized) name as argument. One possibility would be to use a (yet-to-be-invented) function, say FUNCTION-NAME, which returns the name of a function object and passing that name to FIND-DEFINITIONS. But if we invent a FUNCTION-NAME function, we could just as well invent FUNCTION-SOURCE-LOCATION and CLASS-SOURCE-LOCATION, which would easier to use than FIND-DEFINITIONS.
I decided to do this way, because SWANK-BACKEND:FUNCTION-NAME does in fact already exist. And you can retrieve the name of structures and classes via TYPE-OF.
I guess that this will not fly for stuff like:
(setf (fdefinition 'foo) (lambda () ...)) (find-definition-for-thing #'foo)
If you want to stay with FIND-DEFINITIONS: instead of filtering out results manually, it could be be easier to narrow the specification for the argument instead of the return value. E.g. and you could say that for an argument like '(:function (setf foo)) the setf-expanders shouldn't be returned.
This is a possibility. Another possibility would be to specify the return value as outlined in my original posting, with the following addition:
FIND-DEFINITIONS returns a list of
(DSPEC LOCATION &optionally impl-dependent-p)
If IMPL-DEPENDENT-P is non-NIL (it's supposed to be EQ to :IMPLEMENTATION-DEPENDENT in this case, but not mandatorily so.), the DSPEC is of implementation dependent nature, and can anything.
How does this sound?
(In the end, I don't care all /that/ much, but specifying the return value at least for a subset seems to be the more general solution to me, and validating by DESTRUCTURE-CASE is nice for documentation purposes, too.)
Sounds like you already made up your mind.
Helmut.