[Ecls-list] MOP bugs

Juan Jose Garcia Ripoll lisp at arrakis.es
Fri Mar 10 05:08:01 UTC 2006

On Thu, 2006-03-09 at 15:43 +0100, Pascal Costanza wrote:
> One is that add-method doesn't work as expected with generated method  
> instances. Here is an example:
>  > (defgeneric test (x))
>  > (add-method #'test
>      (make-instance 'standard-method
>                     :qualifiers '()
>                     :lambda-list '(x)
>                     :specializers (list (find-class 't))
>                     :function (lambda (x) (+ x x))))
> The slot SI::DATUM in the object  is unbound.

There must be two problems here, one which regards the word "datum", but
this is not relevant for our discussion here. The other one is that the
slot GENERIC-FUNCTION of a method was left initially unbound. I have
fixed this and now this slot is set to NIL for methods which are not
attached to any function (Minor change in src/clos/kernel.lsp)

> The other is that the following functions are plain functions, and  
> not generic ones as required by AMOP: compute-applicable-methods,  
> compute-effective-method, find-method, remove-method and generic- 
> function-method-class.

Some of them, such as FIND-METHOD, REMOVE-METHOD, etc, can be probably
made generic. What cannot be changed right now is the dispatching
mechanism in ECL. That part of the MOP would require serious changes in
the ECL core library.

> Next on my todo list is a first attempt to implement Closer to MOP  
> for ECL.

Thanks in advance for your work on this. Please report any problems you
find. I am more than willing to help on making ECL more useful for the
people who rely on the MOP.

Maybe for testing MOP features you would prefer to work with the fully
interpreted version of ECL. As illustrated below, you can use the bare
bones "ecl_min" lisp environment to load the rest of Common Lisp and MOP
and be able to debug problems in this code.



jlr at mpq3p59:~/src/ecls-new/build$ ./ecl_min
;*** Lisp core booted ****
ECL (Embeddable Common Lisp)  16384 pages
> (load "bare") ;;; Load the rest of Common Lisp
> (si::top-level) ;;; Enter the toplevel
ECL (Embeddable Common-Lisp) 0.9h
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help.  Top level.
> (defgeneric test (x))
> (add-method #'test
     (make-instance 'standard-method
                    :qualifiers '()
                    :lambda-list '(x)
                    :specializers (list (find-class 't))
                    :function (lambda (x) (+ x x))))
> (test 2)

More information about the ecl-devel mailing list