---------- Forwarded message ---------
From:
Marc Feeley <fee...@iro.umontreal.ca>Date: Wed, Jan 9, 2019 at 5:56 PM
Subject: problem with datum label scopes
To: John Cowan <
co...@ccil.org>
There seems to be a problem with the R7RS specification of datum label scopes. Section 2.4 of the R7RS says this:
The scope of a datum label is the portion of the outermost datum in which it appears that is to the right of the label.
This means that the following program conforms to the R7RS:
(define a '#0=(#0#))
(define b '#0=(#0#))
but this program does not conform:
(begin
(define a '#0=(#0#))
(define b '#0=(#0#)))
because it contains a duplicate definition of label 0.
This contradicts the specification of toplevel begin (Section 4.2.3):
(begin <expression or definition> ...) syntax
This form of begin can appear as part of a <body>, or at the outermost level of a <program>, or at the REPL, or directly nested in a begin that is itself of this form. It causes the contained expressions and definitions to be evaluated ***exactly as if the enclosing begin construct were not present***.
Moreover, it would appear useful to have a literal in a program referring to another literal, for example:
(define a '#0=(#0#))
(define b '(#0# #0#))
The definition of the datum label scope in R7RS does not allow this, because the references to #0# in the definition of b are not in the scope of the definition #0=.
For these reasons, the scope of datum labels should be the whole program, not just the outermost datum.
Marc