[armedbear-devel] compiled MACROLET fails to expand in DEFUN/DEFMETHOD forms
![](https://secure.gravatar.com/avatar/b053ca7abf2716d9df3ce01278d60947.jpg?s=120&d=mm&r=g)
The following form fails to compile correctly: (macrolet ((output-var (var) `(format t "var = ~A~%" ,var))) (defun baz (bat) (output-var bat))) When the above form has been compiled and loaded CL-USER> (baz 3) errors by complaining. The function OUTPUT-VAR is undefined. Interestingly abcl-0.12.0 behaves correctly, but abcl-0.15.0 fails (For some reason, I don't currently have abcl-0.{13,14} handy to test). I distilled this bug down from trying to compile CXML, so this is a "real-world" problem. CXML bombs on compiling its "xml/xml-parse.lisp" at this point: … (macrolet ((with-context ((validator) &body body) `(let ((*ctx* (context ,validator)) (*validate* t)) (with-scratch-pads () ;nicht schoen ,@body)))) (defmethod sax:start-element ((handler validator) uri lname qname attributes) uri lname (with-context (handler) (validate-start-element *ctx* qname) (process-attributes *ctx* qname attributes))) … with Wrong number of arguments for CXML::HANDLER. [Condition of type PROGRAM-ERROR] I assume that my "distilled" version has the same cause, namely that the precompiler is not expanding macros properly for function/method definitions in top-level MACROLET forms, but I explicitly mention my root problem here if the slightly different error turns out to provide a clue that I have missed. -- "A screaming comes across the sky. It has happened before, but there is nothing to compare to it now."
![](https://secure.gravatar.com/avatar/b053ca7abf2716d9df3ce01278d60947.jpg?s=120&d=mm&r=g)
On 6/21/10 3:07 PM, Mark Evenson wrote:
The following form fails to compile correctly:
(macrolet ((output-var (var) `(format t "var = ~A~%" ,var))) (defun baz (bat) (output-var bat)))
Bisection show that the first bad revision is: 420 7c7b09e1fe0d 2009-05-22 10:37 +0200 ehuelsmann [svn r11924] Implement compilation of closures with non-empty -- "A screaming comes across the sky. It has happened before, but there is nothing to compare to it now."
![](https://secure.gravatar.com/avatar/29e40ec843bec4b66414022ddce75718.jpg?s=120&d=mm&r=g)
I fixed your example on trunk. Hope that fixes CXML too! Bye, Erik. On Mon, Jun 21, 2010 at 3:07 PM, Mark Evenson <evenson@panix.com> wrote:
The following form fails to compile correctly:
(macrolet ((output-var (var) `(format t "var = ~A~%" ,var))) (defun baz (bat) (output-var bat)))
When the above form has been compiled and loaded
CL-USER> (baz 3)
errors by complaining.
The function OUTPUT-VAR is undefined.
Interestingly abcl-0.12.0 behaves correctly, but abcl-0.15.0 fails (For some reason, I don't currently have abcl-0.{13,14} handy to test).
I distilled this bug down from trying to compile CXML, so this is a "real-world" problem. CXML bombs on compiling its "xml/xml-parse.lisp" at this point:
… (macrolet ((with-context ((validator) &body body) `(let ((*ctx* (context ,validator)) (*validate* t)) (with-scratch-pads () ;nicht schoen ,@body)))) (defmethod sax:start-element ((handler validator) uri lname qname attributes) uri lname (with-context (handler) (validate-start-element *ctx* qname) (process-attributes *ctx* qname attributes))) …
with
Wrong number of arguments for CXML::HANDLER. [Condition of type PROGRAM-ERROR]
I assume that my "distilled" version has the same cause, namely that the precompiler is not expanding macros properly for function/method definitions in top-level MACROLET forms, but I explicitly mention my root problem here if the slightly different error turns out to provide a clue that I have missed.
-- "A screaming comes across the sky. It has happened before, but there is nothing to compare to it now."
_______________________________________________ armedbear-devel mailing list armedbear-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
![](https://secure.gravatar.com/avatar/b053ca7abf2716d9df3ce01278d60947.jpg?s=120&d=mm&r=g)
On 6/21/10 10:43 PM, Erik Huelsmann wrote:
I fixed your example on trunk. Hope that fixes CXML too!
Yes, [r12761][1] fixes the bug and allows CXML to compile and load. Thanks! [1]: http://trac.common-lisp.net/armedbear/changeset/12761 -- "A screaming comes across the sky. It has happened before, but there is nothing to compare to it now."
participants (2)
-
Erik Huelsmann
-
Mark Evenson