[armedbear-devel] Some patches to improve arglist display in Slime

Matthias Hölzl tc at xantira.com
Sun Jan 24 12:44:03 UTC 2010


Currently Slime cannot display arglist information for methods when
running ABCL since ABCL does not export the required parts of the MOP.
Most of the required functionality is already present in ABCL, so I've
implemented the missing functionality (basically only the generic
function COMPUTE-APPLICABLE-METHODS-USING-CLASSES), turned the function
SLOT-DEFINITION-NAME into a generic function and created a patch that
exports the new functionality.  More precisely the externally visible
changes are:

      * SLOT-DEFINITION-NAME is now a generic function with a single
        method specialized on SLOT-DEFINITION  and not a (non-generic)
        function with unspecialized argument.
      * Generic functions and methods for SLOT-DEFINITION-ALLOCATION,
        SLOT-DEFINITION-INITARGS, SLOT-DEFINITION-INITFORM and
        SLOT-DEFINITION-INITFUNCTIONS are defined and exported from the
        MOP package.  For each of these implementations the method
        argument is specialized on SLOT-DEFINITION and the
        implementation simply delegates to the corresponding %
        SLOT-DEFINITION-* function.
      * COMPUTE-APPLICABLE-METHODS-USING-CLASSES is implemented as
        generic function and exported from the MOP package.

The behavior of these functions should be as specified in AMOP, but
there are some caveats: 

     1. I have not checked my implementation of C-A-M-U-C against any
        other CLOS implementation, so I might have made mistakes or
        misunderstood something.
     2. The methods for SLOT-DEFINITION-ALLOCATION, etc. are specialized
        on SLOT-DEFINITION and not, as specified in AMOP, on
        STANDARD-SLOT-DEFINITION since ABCL does not seem to implement
        the latter class.  I don't know enough about ABCL to know what
        the preferred way of introducing STANDARD-SLOT-DEFINITION would
        be; re-implementing the slot-definition part in Lisp,
        subclassing Lisp classes from the Java class, or defining
        subclasses of existing classes in Java all seem like viable
        solutions.

To implement these things I've made some minor internal changes; in
particular:

     1. I've extracted a function to sort methods from the
        implementation of %COMPUTE-APPLICABLE-METHODS since this
        algorithm is now needed in
        COMPUTE-APPLICABLE-METHODS-USING-CLASSES as well.
     2. I've renamed METHOD-APPLICABLE-P-USING-CLASSES to
        METHOD-APPLICABLE-USING-CLASSES-P, changed its implementation
        and extended its implementation to take into account EQL
        specializers.
     3. I've removed the autoload for SLOT-DEFINITION-NAME.  I don't
        know enough about the ABCL compiler to understand what the
        purpose of autoloading some things is, so I don't know whether
        autoloads for SLOT-DEFINITION-NAME et al. should be added
        somewhere.  Leaving them out does not seem to break anything but
        it might have undesired consequences that I have missed.

The patch contains a few tests to verify that it does not completely
break the compiler, but not a complete test-suite for the new
functionality.

Current Slime needs a one line patch to enable arglist display for the
patched ABCL; I've included this patch as well.

Best regards,

  Matthias

-------------- next part --------------
A non-text attachment was scrubbed...
Name: abcl-mop.patch
Type: text/x-patch
Size: 19560 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/armedbear-devel/attachments/20100124/cd86c7f0/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: abcl-arglist.patch
Type: text/x-patch
Size: 545 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/armedbear-devel/attachments/20100124/cd86c7f0/attachment-0001.bin>


More information about the armedbear-devel mailing list