unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Problem with define-macro from compiled file (Guile 1.9)
@ 2011-01-06 18:18 Patrick Bernaud
  2011-01-06 23:58 ` Ludovic Courtès
  2011-01-07  8:53 ` Hans Aberg
  0 siblings, 2 replies; 6+ messages in thread
From: Patrick Bernaud @ 2011-01-06 18:18 UTC (permalink / raw)
  To: guile-user

Hello,

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!
Backtrace:
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 "/home/pat/.cache/guile/ccache/2.0-0.T-LE-4/home/pat/devel/guile/test.scm.go"]
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?

Regards,


Patrick



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-01-08 12:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-06 18:18 Problem with define-macro from compiled file (Guile 1.9) Patrick Bernaud
2011-01-06 23:58 ` Ludovic Courtès
2011-01-07  8:53 ` Hans Aberg
2011-01-07 23:22   ` Andreas Rottmann
2011-01-08  9:46     ` Hans Aberg
2011-01-08 12:00     ` Predicate of define-syntax Hans Aberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).