[Ecls-list] Bug in define-method-combination
Pascal Costanza
pc at p-cos.net
Sun Nov 29 19:07:14 UTC 2009
Hi,
Here is a patch that should solve this problem:
Index: src/clos/combin.lsp
===================================================================
RCS file: /cvsroot/ecls/ecl/src/clos/combin.lsp,v
retrieving revision 1.23
diff -r1.23 combin.lsp
281c281
< (effective-method-function , at body t))))
---
> (effective-method-function (progn , at body) t))))
Best,
Pascal
On 29 Nov 2009, at 00:11, Pascal Costanza wrote:
> Hi,
>
> And another final bug report. Two good news: If all the bugs I have reported in the last day, or so, are fixed, all my test suites for Closer to MOP, AspectL, ContextL and filtered functions (the last one not released yet) run successfully. They already run successfully with some workarounds I use in the meantime. The other 'good' news item is that this bug report is rather entertaining (but it was hard to find).
>
> Consider the following example:
>
> (define-method-combination my-standard ()
> ((around (:around))
> (before (:before))
> (primary () :required t)
> (after (:after)))
> "This is the same as Common Lisp's standard combination."
> (flet ((call-methods (methods)
> (mapcar #'(lambda (method)
> `(call-method ,method))
> methods)))
> (let ((form (if (or before after (rest primary))
> `(multiple-value-prog1
> (progn ,@(call-methods before)
> (call-method ,(first primary)
> ,(rest primary)))
> ,@(call-methods (reverse after)))
> `(call-method ,(first primary)))))
> (if around
> `(call-method ,(first around)
> (,@(rest around)
> (make-method ,form)))
> form))))
>
> (defgeneric foo ()
> (:method-combination my-standard)
> (:method () "Hello, World!"))
>
> This is saved in a file called 'comb.lisp'. Here is now an example session:
>
>> (load "comb.lisp")
>
> ;;; Loading "/Users/costanza/Muell/comb.lisp"
> #P"/Users/costanza/Muell/comb.lisp"
>> (foo)
>
> Wrong number of arguments passed to an anonymous function
>
> Available restarts:
>
> 1. (RESTART-TOPLEVEL) Go back to Top-Level REPL.
>
> Broken at LAMBDA. In: #<process SI:TOP-LEVEL 00000001005c0f60>.
> File: #P"/Users/costanza/Muell/comb.lisp" (Position #0)
>>> :r1
>
>> (trace clos::effective-method-function)
>
> (CLOS::EFFECTIVE-METHOD-FUNCTION)
>> (foo)
>
> 1> (CLOS::EFFECTIVE-METHOD-FUNCTION
> "This is the same as Common Lisp's standard combination."
> (CALL-METHOD #<STANDARD-METHOD FOO NIL>)
> T)
>
> Wrong number of arguments passed to an anonymous function
> Available restarts:
>
> 1. (RESTART-TOPLEVEL) Go back to Top-Level REPL.
>
> Broken at CLOS::EFFECTIVE-METHOD-FUNCTION. In: #<process SI:TOP-LEVEL 00000001005c0f60>.
>>>
>
>
> So what apparently happens here is that because of the way how user-defined method combinations are processed in ECL, the documentation string for a method combination remains part of the actual computation of the method combination, and then gets passed to the final transformation to an effective method function.
>
> I know Lispers are not so keen on writing documentation, but they shouldn't be sabotaged either if they want to do that... ;)
>
>
> Anyway, the CLOS MOP support in ECL looks already a lot better than when I last looked at it. I'm pretty happy with being able to turn it into one of the better supported CLOS implementations for Closer to MOP.
>
>
> Best,
> Pascal
>
> --
> Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
> Vrije Universiteit Brussel
> Software Languages Lab
> Pleinlaan 2, B-1050 Brussel, Belgium
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Ecls-list mailing list
> Ecls-list at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ecls-list
--
Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
Vrije Universiteit Brussel
Software Languages Lab
Pleinlaan 2, B-1050 Brussel, Belgium
More information about the ecl-devel
mailing list