Questions, loose ends, misprints, etc.
Andre van Tonder 01 Dec 2005 15:00 UTC
Here are a few questions and possible loose ends that occurred to me
while reading the document. Some of these may of course only reflect
a lack of understanding on my part:
- Can I shadow CAR from the R6RS language, either with an import
or a local definition? This kind of thing is potentially useful.
However, the document says: "No identifier can be imported multiple
times...", which seems to preclude this, unless the "language" is
conceptually not an import?
- Is "scheme://r6rs" also a library? Specifically, can I say
(import (add-prefix "scheme://r6rs" r6rs:))
- Related to previous: Does the language specification act semantically
like an import? It might be helpful to explain the difference, if any.
In particular, is "scheme://r6rs" also visited/invoked, and what do
these mean, if anything, for the R6RS dynamic environment?
- Can I import different bindings for the same identifier into different
phases? I'm not sure if the document forbids this. In fact, it
explicitly allows the /same/ binding to be imported into different
phases (which is also conceptually a "multiple" import).
I know MzScheme allows this, and it is also potentially
quite useful.
- Is the "language" imported into all reflective levels (no matter
how deep LET-SYNTAX is nested)?
- Would it be possible to provide a rationale for the notion of
indirect exports. The thing is, I know of at least two module
systems that do well without this notion. I kind of see why it
is in there, but at the same time it kind of seems to conflict
(at least a little bit) with the notion of lexical scoping.
- The IMPORT DSL makes me uncomfortable, since the directives do
not seem to compose. For example, it would be nice to compose ONLY
and ADD-PREFIX.
However, this objection might be unfounded. In fact, I think there is
a misprint in the document. Shouldn't <X-set> be <import-set> in
this snippet?
<import-set> = <lib-path>
| (only <X-set> <identifier>*)
| (except <X-set> <identifier>*)
| (add-prefix <X-set> <identifier>)
| (rename <X-set> (<identifier> <identifier>)*)
- It would be more general, and would simplify the IMPORT DSL, if one could
specify arbitrary computations on imported identifiers. Something like
(import "scheme" (lambda (symbol)
(case symbol
((car) 'scheme:car)
((cdr) 'scheme:cdr)
(else #f))))
from http://www.het.brown.edu/people/andre/macros/srfi-module.htm.
However, you may have other reasons for preferring a syntactic DSL.
- It would be nice if the toplevel could also be considered an implicit
library. But the no-shadowing and no-redefinition rule would
seem to preclude this.
- Can I export an unbound identifier? For example, can I export
literals (such as ELSE, UNQUOTE, etc.), or does this not even make
sense.
Another potential application of this would be to make a module
that "undefines" some bindings from "scheme://r6rs" to make a restricted
language.
Regards
Andre