[R6RS] libraries without procedural macros

Matthew Flatt mflatt at cs.utah.edu
Wed Dec 6 01:48:55 EST 2006


It looks to me like R6RS will stick with relatively weak guarantees
about library phasing and invocation, especially as they relate to
procedural macros. An open question is whether we can make more
specific statements about programs whose libraries use only
`syntax-rules'.

One problem is specifying what "use only `syntax-rules'" means well
enough to avoid some unspecified behavior. A first attempt might be:
the `for' import form is never used, and the RHS of all
`define-syntax', `let-syntax' and `letrec-syntax' bindings always start
`(syntax-rules ...)'. But the `(r6rs base)' library does not export
`syntax-rules' for expand, so importing `(r6rs base)' would not make
`syntax-rules' available for the RHSs in some implementations. We could
avoid this mismatch by having `syntax-rules' exported from `(r6rs
base)' for expand --- maybe even only for expand, which avoids the
question of what `syntax-rules' means as a run-time expression.

The other potential problem has to do with invocation and effects. As I
understand one of the proposals, invoking the `(b)' library defined as

 (library (a)
   (import)
   (export)
   (display "hello\n"))

 (library (b)
   (import (a))
   (export)
   (display "goodbye\n"))

would display only "goodbye", not "hello", because `(b)' does not
actually use anything exported from `(a)'. Assuming that I understand
the proposal, my best guess is that this will have to remain an area of
unspecified behavior, but I'm not sure.

Matthew




More information about the R6RS mailing list