[Scheme-reports] Formal - Internal syntax definitions vs a body with definitions being a letrec* Jussi Piitulainen (27 Jun 2012 18:44 UTC)

[Scheme-reports] Formal - Internal syntax definitions vs a body with definitions being a letrec* Jussi Piitulainen 27 Jun 2012 18:44 UTC

Formal Comment
on draft 6 of the r7rs small-language report
by Jussi Piitulainen <jpiitula@ling.helsinki.fi>

I desire a clarification on how a body that begins with internal
definitions can be equivalent to a letrec* when syntax definitions are
valid wherever definitions are.

The coverage of the related issues in the report has improved much
since I last read it. I'm still not quite satisfied about this
particular issue: the report seems to me to be silent, or at best much
more implicit than I like, about how a body like the following is
equivalent to a letrec*. There is no room in a letrec* for the syntax
definition:

(lambda () ;say
   (define (f x) ...)   ;the body begins
   (define-syntax ...)
   (f ...))

If there is a sentence or two that would make the intent of the
authors explicit, please add them to the report (in 5.2.2 where the
crucial statement of the equivalence is made). Possibly it is
something about an "expanded body" not containing the
syntax-definitions any more, but I feel like I'm guessing here and
looking for some statement that is not there in the report.

I'm concerned because I like the equivalence and wish it to be true.

Relevant sites in the report follow (and a couple of related lesser
concerns that turn up when I was investigate this, but it is the issue
above that I formally wish to be clarified).

4.2.3 Sequencing (p. 16)
(begin <expression or definition> ...)
may appear as part of a <body>, [...]
rationale: [macro output]

5.2 Definitions (p. 23 bottom right)
... valid ... at the _beginning_ of a <body>. [my emphasis]

5.2.2 Internal definitions (p. 24 right, mid-section)
An expanded <body> containing internal definitions can always be
converted into a completely equivalent letrec* expressions.

5.3 Syntax definitions (p. 25 top left)
Syntax definitions are valid wherever definitions are.

7.1.3 Expressions (p. 58 right)
<body> --> <definition>* <sequence>

7.1.6 Programs and definitions (p. 60 left)
<definition> --> ... | <syntax definition> | ...

Finally, I still have a related concern about <body>: the entry on
lambda expressions does not tell the truth about <body> allowing
internal definitions, yet several binding constructs refer to it as
being authoritative about <body>:

4.1.4 Procedures (p. 12 bottom right)
... <body> should be a sequence of one or more expressions.
[this does not allow internal definitions]

4.2.4 Binding constructs (p. 15-16)
... <body> should be a sequence of zero or more expressions followed
by a sequence of one or more expressions as described in section
4.1.4. ... [this appears in every binding construct and is fine]

Finally finally, "body" is not an index entry (p. 77) and it should
be. Probably it should point to 4.1.4 but, as noted above, that site
does not tell the truth about <body>, or body, and maybe to 5.2.2,
where I'm formally seeking clarification. Thank you for your
attention.

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