[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with define-macro from compiled file (Guile 1.9)

From: Patrick Bernaud
Subject: Problem with define-macro from compiled file (Guile 1.9)
Date: Thu, 6 Jan 2011 19:18:52 +0100


I have a case where a macro is defined in a file that is then loaded
by another which makes use of the macro. And it produces a 'wrong type
to apply' error from the VM.

(Works fine with GUILE_AUTO_COMPILE=0 and compiled files removed).

For example, with the 'when' macro from the manual:

-%<---- when.scm ----%<-
(define-macro (when cond exp . rest)
  `(if ,cond
       (begin ,exp . ,rest)))
-%<---- when.scm ----%<-

-%<---- test.scm ----%<-
(load "when.scm")
(when #t (display "Launching missiles!\n"))
-%<---- test.scm ----%<-

I get:

$ guile -s test.scm
Launching missiles!
In ice-9/boot-9.scm:
 170: 9 [catch #t #<catch-closure 8ebb2c0> ...]
In unknown file:
   ?: 8 [catch-closure]
In ice-9/boot-9.scm:
  62: 7 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
 389: 6 [eval # #]
In ice-9/boot-9.scm:
1863: 5 [save-module-excursion #<procedure 8f0dc90 at ice-9/boot-9.scm:1877:3 
1171: 4 [load "test.scm" #f]
In unknown file:
   ?: 3 [load-compiled/vm 
In test.scm:
   2: 2 [#<procedure 8e835a0 ()>]
In ice-9/boot-9.scm:
 115: 1 [#<procedure 8e354d8 at ice-9/boot-9.scm:110:6 (thrown-k . args)> 
wrong-type-arg ...]
In unknown file:
   ?: 0 [catch-closure wrong-type-arg #f ...]

ERROR: In procedure catch-closure:
ERROR: Wrong type to apply: #<syntax-transformer when>

Am I doing wrong something wrong?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]