[R6RS] strawman module syntax
Thu Jan 22 11:03:26 EST 2004
Here's a strawman proposal for the syntax of a module system.
Naturally, it's based on the MzScheme system, so you may want to start
The idea is that a program X corresponds to a file "X.scm" (which
contains a single `X' module declaration) plus all of the module files
in the transitive closure of "require"s starting from "X.scm".
I make no attempt to provide a semantics at this point, because I
expect it's obvious.
I've stuck to MzScheme's syntax (a restricted version), rather than
trying to anticipate objections and fix them. It's just a strawman,
after all. There are some exceptions, because Richard, Mike, and I
discussed this a couple of years ago, and I've deviated from MzScheme
in a few ways based on that discussion.
At this point, I'm ignoring the possibility of macros other than those
implemented with `syntax-rules'.
<module> = (module <identifier> ; Matches the filename?
<require> ; Language designation
; The syntax for <clause> is determined by the language,
; but the standard-language <clause> is as follows
<clause> = (require <require-spec> ...)
| (provide <provide-spec> ...)
| (begin <statement> ...)
; Core R6RS statements
| (include <path-spec> ...)
; Each files that contains
; a sequnce of core R6RS
<require> = <path-spec> ; A path to a module "file"
| <identifier> ; A pre-defined module
<provide> = <identifier> ; Possibly defined as syntax
| (all-from <require>) ; Re-export imports using
; local names
For _X_ as either <require> or <provide>:
<_X_-spec> = _X_ ; Everything from _X_
| (only <_X_-spec> <identifier> ...)
; Restrict to specific ids
| (except <_X_-spec> <identifier> ...)
; Remove specific ids
| (add-prefix <_X_-spec> <identifier>)
; Add a uniform prefix
| (drop-prefix <_X_-spec> <identifier>)
; Remove a uniform prefix
| (rename <_X_-spec> (<identifier> <identifier>) ...)
| (alias <_X_-spec> (<identifier> <identifier>) ...)
; Add additional name
<path-spec> = <string> ; A Unix-style relative path
| (file <string>) ; An OS-specific absolute path
| (lib <string> ...) ; A path in a designated
; library area, much like
More information about the R6RS