[gambit-list] "unbound variable" after importing macro from library

Lassi Kortela lassi at lassi.io
Thu Oct 17 08:14:48 EDT 2019

With the current master branch of Gambit, given the files:

==> foo.scm <==
(define-macro (hello)
   '(display "Hello world\n"))

==> foo.sld <==
(define-library (foo)
   (export hello)
   (import (scheme base) (gambit))
   (include "foo.scm"))

The following error occurs:

$ gsi .
 > (import (foo))
 > (hello)
*** ERROR IN (stdin)@2.2 -- Unbound variable: foo#hello

Using ##define-macro instead of define-macro has the same effect, as do 
`gsi -:r7rs .`, using (load "foo.scm") instead of (import (foo)), and 
using the compiler instead of the interpreter. However, copy/pasting the 
define-macro form into the REPL works fine. Exporting procedures 
(instead of macros) works fine. What is the best current practice for 
exporting macros?

More information about the Gambit-list mailing list