[gambit-list] more problems with blackhole

Per Eckerdal per.eckerdal at gmail.com
Mon May 18 06:14:58 EDT 2009


> In the following code, what I'm trying to understand is ...
>
> why does the namespace seem to treat functions and macros  
> separately? In particular, there does not seem to be anyway for me  
> to access 'bar' in test2 once I (export)
>
> ~/magic$ cat test.scm
> (define (foo x) (list x x))
> (define-macro (bar x) `(list ,x ,x))
> ~/magic$ cat test2.scm
> (export)
> (define (foo x) (list x x))
> (define-macro (bar x) `(list ,x ,x))

(export) takes a list of identifiers to export. Files with no (export)  
form are treated specially, and export everything. This is to make BH  
able to use R5RS code out of the box. So you either 1) have no export  
form, or 2) have an export form which declares everything to be  
exported, for instance

(export foo bar)

I usually develop modules without export forms first, then, when I  
want to clean up the public API, add an export form. There is a  
utility function for this called module-generate-export-list, that  
returns an export form that is equivalent to not having one at all:

(module-generate-export-list 'test2)

Should return something like (export foo bar)

/Per




More information about the Gambit-list mailing list