This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home.

Ticket 276: Ordering conventions for identifiers in modules

2012-02-27 04:39:59
WG1 - Core
alexshinn
major
cowan
duplicate
source
closed
2011-09-08 04:15:53
defect

Chicken modules work like this, and it's compatible with R6RS. See also The tale of Professor Simpleton and Dr. Hardcase.

resolutioninvalid
statusnewclosed

The example is broken, define is not a library declaration. A possible example would have to be (begin (define x y)).

However this suggests a misunderstanding of the library semantics as described in the draft - all declarations are cond-expanded, an environment of all imports is created, and then the library body is expanded. There is no way any code can interfere with the imports.

We could specify that all imports must occur before all code (and presumably that all exports then must occur before all imports as in R6RS), but I'm not sure of the motivation for this, and am marking the ticket invalid pending a clearer proposal.

descriptionFor ease of implementation, I think we should make it an error to refer to an identifier before it is imported or define an identifier before it is exported. This allows modules to just do name control and not also have to be scopes. So this would be an error (but still permitted as an extension in Schemes that can easily provide it): {{{ (module (define x y) (import (something defining y)) (export x)) }}}'''New'''
resolutioninvalid
statusclosedreopened

See replacement ticket #353.

If there's a replacement ticket, shouldn't this one remain closed?

description'''New'''
resolutionduplicate
statusreopenedclosed

Yes, it should. I screwed up.