[gambit-list] define-syntax and loading files

Taylor Venable taylor at metasyntax.net
Fri Jun 12 10:47:04 EDT 2009

I'm having some trouble understanding the behavioural differences in
this code:

BEGIN FILE test-alpha.scm --------------------------------------------

    (define-syntax foo
      (syntax-rules (xyzzy)
        ((_ xyzzy) "nothing happens")))

BEGIN FILE test-beta.scm ---------------------------------------------

    (load "test-alpha.scm")
    (define bar
      (lambda ()
        (foo hello)))

If I load test-beta.scm twice, I get an error on the second load but
not on the first one:

> (load "test-beta.scm")
> (load "test-beta.scm")
*** ERROR IN %%chi-macro437, "/opt/gambit/lib/syntax-case.scm"@9135.1 -- invalid syntax (foo hello)

But if I do what seems like it should be the equivalent of loading
test-alpha.scm, then loading test-beta.scm I get an error on the first
load of test-beta:

> (load "test-alpha.scm")
> (load "test-beta.scm") 
*** ERROR IN %%chi-macro437, "/opt/gambit/lib/syntax-case.scm"@9135.1 -- invalid syntax (foo hello)

It seems to me that loading test-beta by itself should be the same as
loading test-alpha then test-beta, but it's not quite.  Why is this?

For what it's worth, my Gambit version string is:
v4.4.4 20090611032636 amd64-unknown-openbsd4.5
"./configure --prefix=/opt/gambit --enable-single-host"


Taylor Christopher Venable

More information about the Gambit-list mailing list