[slime-devel] Re: SWANK-BACKEND:FIND-DEFINITIONS -- return value specification.

Helmut Eller heller at common-lisp.net
Sun Feb 24 16:40:29 UTC 2008


* Tobias C. Rittweiler [2008-02-23 12:07+0100] writes:

> Helmut Eller <heller at common-lisp.net> writes:
>
>> Currently, we use the dspec part only for display purposes.  It would be
>> good to find a useful application for these dspecs before spending too
>> much time on them.
>
> I've written a FIND-DEFINITION-FOR-THING that tries to find the
> definition of the data structure behind an object. And I've got to rule
> out definitions returned from FIND-DEFINITIONS which don't match. 
>
> For example:
>
>   (find-definitions '(setf car)) 
>
> may return definitions for a SETF-EXPANDER and for a SETF function
> definition for CAR.
>
> However,
>
>   (find-definition-for-thing #'(setf car))
>
> may only return the SETF function definition.
>
> Objective is to provide a general Find Definition menu option for
> presentations.
>
> Does this count as useful application?

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.

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.

Helmut.




More information about the slime-devel mailing list