[slime-devel] Find Definitions

Terje Norderhaug terje at in-progress.com
Tue Dec 22 00:52:14 UTC 2009


On Dec 19, 2009, at 12:59 AM, Helmut Eller wrote:
> * Terje Norderhaug [2009-12-18 20:32+0100] writes:
>
> [...]
>> Of particular concern is the DSPEC, which Clozure returns as  
>> "#'SWANK-
>> BACKEND:FIND-DEFINITIONS" and LispWorks returns as "(DEFUN SWANK-
>> BACKEND:FIND-DEFINITIONS)". It would be helpful if the DSPEC
>> standardized on the same symbol to denote that the definition is for
>> a function, as in (FUNCTION SWANK-BACKEND:FIND-DEFINITIONS).
>>
>> To facilitate client side use and flexibility in presentation, I also
>> suggest that the DSPEC is returned as a list instead of as a string,
>> with the type as a symbol and the function name encoded as a string,
>> as in (FUNCTION "SWANK-BACKEND:FIND-DEFINITIONS").
>
> Assigning a standard meaning would be pretty difficult as
> implementations differ considerably in this area.  E.g Allegro has
> fspecs while Lispworks has dspecs. Fspecs are for functions only but
> dspecs are indented for all kinds of definitions and new dspecs can be
> added by users.  It's much simpler to treat dspecs as strings and just
> display them as label.

MCLIDE needs to be able to filter definitions based on their type, as  
well as present the dspec in custom ways.

How can we make swank provide the information required for clients to  
make sense out of the specs? That is, not just display a pre-formated  
string, but being able to do filtering and other processing based on  
the dspecs, including custom presentation.

Perhaps the backend for the different implementations could provide  
clients with a dspec type hierarchy or mapping from canonical  
definition types to the type symbols used in their dspecs. That way,  
clients could determine that when LispWorks provides a dspec of type  
DEFUN and Clozure provides a dspec of type FUNCTION, both are dpecs  
for functions.

Take the dpecs in my original post, where each lisp implementation  
provided a different dspec in response to (swank:find-definitions-for- 
emacs "swank::find-definitions"):

Clozure => "#'SWANK-BACKEND:FIND-DEFINITIONS"
LispWorks =>"(DEFUN SWANK-BACKEND:FIND-DEFINITIONS)"

Ignore the extra complication that Clozure reports (FUNCTION SWANK- 
BACKEND:FIND-DEFINITIONS) as #'SWANK-BACKEND:FIND-DEFINITIONS.

For a client to know that either of these dpecs are for function  
definitions, there could be a implementation specific backend  
function that declares the definition types provided by the  
implementation, e.g.:

(definterface definition-types ()
   "Type hierarchy or map from canonical definition types to the type  
symbols used in their dspecs."
   nil)

Clozure:

(defimplementation definition-types ()
   '((:function function) (:class class) ...))

LispWorks:

(defimplementation definition-types ()
   '((:function defun) ...))

SBCL:

(defimplementation definition-types ()
   '((:function defun) (:class defclass)  
(:optimizer :defoptimizer) ...))


-- Terje Norderhaug
    terje at in-progress.com








More information about the slime-devel mailing list