[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Scheme-reports] Import declarations in programs



Hi,

by 5.1. "Programs" and in 7.1.6. "Programs and definitions" of the R7RS specification, a Scheme program begins with one or more import declarations followed by a sequence of expressions and definitions.

I have two issues with this:

1) Why is more than one import declaration allowed in a Scheme program? One would suffice as one import declaration can contain more than one import set. In R6RS only one and exactly one import form is allowed for top-level programs. Likewise the WG1 Library Syntax proposal of Alex Shinn does not mention more than one import form for programs and refers to R6RS in this regard.

2) Given the program

(import (lib1))
(import (lib2))

the behavior does not seem to be specified if lib1 exports an identifier named import. Is the second line still part of the sequence of one and more import declarations as in 5.1. or already the first of the sequence of expressions and definitions?

Both options are semantically fundamentally different so I don't think it is a good idea to leave this edge case open by the specification. What's worse I don't see any of the two options well justified.

Note that if only one and exactly one import declaration was allowed in a Scheme program, this ambiguity wouldn't arise. I thus propose the following for an erratum of the specification:

a) Make it clear how a program is being parsed (e.g. say when does the sequence of import declarations end). There may very well be a discussion what the better option is.

b) Allow implementations to only support one and only one import declaration in Scheme programs and make this the recommended style of importing libraries (as it is already done in 5.6.2. "Library example").

Best,

Marc
_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports