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 473: library declaration locations in top-level

2012-10-12 02:22:27
WG1 - Core
2012-09-13 21:13:27

R6RS allows only a single library declaration, import, at the beginning of a program body, and this must contain all imported libraries.

Pending the result of ticket #472 we may also allow include(-ci) and cond-expand to expand into imports, and so the single form restriction would not make sense. However, it would be reasonable to restrict all library declarations to the beginning of a program - the first non-declaration would begin the real body. This is the beginning-only option.

The advantage of the r6rs proposal is that it would not require any changes in existing R6RS program loading implementations to support. If the result of ticket #472 indicates multiple declaration types are available this option would automatically become invalid, so you don't need to vote against it on those grounds.

The advantage of the beginning-only option is that it becomes possible to statically determine all program imports without expansion, which was the primary motivation of a static library system.

The final alternative is any-top-level, which allows these forms anywhere at the top-level, possibly interspersed with definitions. The advantage of this is that you can cut&paste repl sessions (for which interspersed imports are always allowed) as a program. The disadvantage is that programs can no longer be resolved separately from expansion.


WG1 voted to adopt the beginning-only alternative. This means that programs (but not libraries or the REPL) must have all their import declarations appear at the beginning of the program.