Comment 0 for bug 173908

Revision history for this message
Derick Eddington (derick-eddington) wrote : Macro expansion to (include ...) not working inside library

I'm working on porting SRFIs and I made an include/resolve which searches the library-path so the original reference implementation files can be included into the library, and I ran into the below problem. Macro expanding to include in the top-level interaction environment works and makes the bindings available, but when it's done in a library the bindings aren't able to be exported. It doesn't seem to be a problem with (begin ...) splicing, maybe because include is a built-in macro?

$ cat to-include.scm
(define x 123)
(define y 54321)
(define (f z) (+ x y z))
(define-syntax s (syntax-rules () [(_ a) '(a a a)]))
$
$ ikarus
Ikarus Scheme version 0.0.2patched+ (revision 1181, build 2007-12-03)
Copyright (c) 2006-2007 Abdulaziz Ghuloum

> (library (include-it)
    (export include-it)
    (import (ikarus))
    (define-syntax include-it
      (lambda (stx)
        (syntax-case stx ()
          [(_) #'(include "to-include.scm")]))))
>
> (library (hmm)
    (export x y f s)
    (import (rnrs) (include-it))
    (include-it))
Unhandled exception
 Condition components:
   1. &error
   2. &who: expander
   3. &message: "cannot export unbound identifier"
   4. &irritants: (s)
>