[Ecls-list] ECL & Closer-mop

Pascal Costanza pc at p-cos.net
Sun Dec 2 22:00:47 UTC 2012


On 2 Dec 2012, at 22:48, Juan Jose Garcia-Ripoll <juanjose.garciaripoll at gmail.com> wrote:

> On Sun, Dec 2, 2012 at 9:11 PM, Pascal Costanza <pc at p-cos.net> wrote:
> 4) DEFMETHOD doesn't call MAKE-METHOD-LAMBDA to determine the method function body. [My guess is that this is not easy to change due to the deviation from the MOP specification in how method functions are called.]
> 
> I will look into the other issues, but this is definitely not true. In ecl/src/clos/method.lsp, line 82, 
> ...
> 	  (multiple-value-bind (fn-form options)
> 	      (make-method-lambda generic-function method lambda-form env)
> 	    (when documentation
> 	      (setf options (list* :documentation documentation options)))
> 	    (multiple-value-bind (wrapped-lambda wrapped-p)
> 		(simplify-lambda name fn-form)
> ...
> 
> ECL calls make-method lambda and then looks at the output to see whether it can be transformed into the C-optimized dispatch that we use.
> 
> It would be important to have a test case that shows when make-method-lambda is not working. What in particular made you think so?
> 



Here is a test case:

> (use-package :clos)

T
> (defclass my-generic-function (standard-generic-function) () (:metaclass funcallable-standard-class))

#<The CLOS:FUNCALLABLE-STANDARD-CLASS COMMON-LISP-USER::MY-GENERIC-FUNCTION>
> (defgeneric f (x) (:generic-function-class my-generic-function))

#<my-generic-function F>
> (defmethod make-method-lambda :after ((gf my-generic-function) (method standard-method) (lambda-expression t) (enviroment t)) (print :foo))

#<standard-method MAKE-METHOD-LAMBDA (#<The CLOS:FUNCALLABLE-STANDARD-CLASS COMMON-LISP-USER::MY-GENERIC-FUNCTION>
                                      #<The STANDARD-CLASS STANDARD-METHOD>
                                      #<The BUILT-IN-CLASS T>
                                      #<The BUILT-IN-CLASS T>)>
> (defmethod f ((x integer)) (+ x x))

#<standard-method F (#<The BUILT-IN-CLASS INTEGER>)>



Pascal


--
Pascal Costanza



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20121202/0a3bf750/attachment.html>


More information about the ecl-devel mailing list