[R6RS] libraries
dyb at cs.indiana.edu
dyb
Tue Dec 13 13:56:42 EST 2005
> (define pi 3.1416)
> (immutable pi)
> (export pi)
>
> instead of
>
> (define-exported-constant pi 3.1416)
>
> Can this be done with syntax-case?
Such a thing would be compabible with syntax-case, but I don't think
offhand that one could write immutable as a macro. immutable would
probably have to be built-in. One can write define-immutable as a macro
with syntax-case, but you're right that this could lead to a proliferation
of definition forms (like define-type/immutable to make the define-type
products immutable).
Another possibility is for immutable to be a prefix one can place in
front of a definition, like (immutable define ---) or
(immutable define-type ---). (immutable <defnkwd> <subform> ...)
would produce the same set of definitions as (<dfnkwd> <subform> ...)
but all resulting variable bindings would be immutable.
Yet another possibility is to control mutability at the library level,
i.e., have the library form specify whether its exports are mutable
or not.
Kent
More information about the R6RS
mailing list