[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Library semantics - higher level imports
It would be straightforward to extend this to higher level imports. First, the
import syntax might be modified to something similar to:
(for "library" (phase 0)
(phase 3)) ; imports into phases 0, 1 and 3
where (phase 0) = RUN
(phase 1) = SYNTAX
(library "m" "r6rs"
(define x 1))
(library "n" "r6rs"
(import (for "m" (phase 2)))
(let-syntax ((a (lambda (exp)
(let-syntax ((b (lambda (exp) x))) ; use of x
The change in the semantics would then be:
To visit a library at phase N:
* Visit at phase N any library that is imported by this library
for ... (phase 0), and that is not yet visited at phase N.
* For each k >= 1, invoke at phase N+k any library that is imported
by this library for .... (phase k), and that is not yet invoked at
* For each k >= 1, visit at phase N+1 any library that is imported by
this library for .... (phase k), and that is not yet visited at phase
* Evaluate all syntax definitions within the library.
(Top-level expressions are not evaluated, and the right-hand sides
of variable definitions are not evaluated.)
Sometimes it is useful to import a library for all phases. For example, this
may be what is implicitly done for the r6rs language, so one could also have
(for "library" all) == (for "library" (phase 0) (phase 1) (phase 2) .....)