[gambit-list] How to load syntax definitions?

Jeff Read bitwize at gmail.com
Mon Jan 16 13:42:10 EST 2012


Try (include "y.scm").

Rationale: In Gambit, syntax definitions are not visible across
compilation-unit boundaries; each .scm file is a single compilation unit.
However the INCLUDE form copies the text of the included file verbatim into
the current compilation unit -- just like C #include -- so, much like C,
you will want to factor out your syntax definitions into a separate "header
file" and INCLUDE them where needed.
On Jan 16, 2012 1:35 PM, "Sascha Ziemann" <ceving at gmail.com> wrote:

> I have a problem loading a file which defines syntax. It does not work
> in Gambit although it works in other Schemes.
>
> This is file x.scm:
>
> (define-syntax x
>  (syntax-rules ()
>    ((_) (display "x\n"))))
> (load "y.scm")
> (x)
> (y)
>
> And this is y.scm:
>
> (define-syntax y
>  (syntax-rules ()
>    ((_) (display "y\n"))))
>
> When I run Gambit I get an error:
>
> $ gsi -:s x.scm
> x
> *** ERROR IN "x.scm"@8.2 -- Unbound variable: y
>
> But this works in Gauche, Bigloo and Chicken:
>
> $ gosh x.scm
> x
> y
>
> $ bigloo -s -i x.scm
> x
> y
>
> $ csi -qb x.scm
> x
> y
>
> Who is right?
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20120116/c0bb53de/attachment.htm>


More information about the Gambit-list mailing list