[r6rs-discuss] [Formal] Relax ordering constraint on library bodies

John Cowan cowan at ccil.org
Sat Jan 20 13:33:46 EST 2007


---
This message is a formal comment which was submitted to formal-comment at r6rs.org, following the requirements described at: http://www.r6rs.org/process.html
---
Submitter: John Cowan
Email address: cowan at ccil.org
Issue type: Defect/Simplification
Priority: Major
Component: Libraries
Report version: 5.92
Summary: The ordering restriction on declarations and expressions in
library bodies should be relaxed.

Currently, library bodies are required to have declarations before
expressions as a matter of syntax.  The informal semantics in report
section 6.1 work fine whether this restriction is implemented or not,
and the formal semantics in report chapter 10 go to the trouble of
explaining that the syntactic restriction is not enforced there.

Relaxing this restriction enables the user to write code like this in
a library (it's already legal in a top-level program):

	(define foo ...)
	(install foo 'foo)

	(define bar ...)
	(install bar 'bar)

and even to generate these pairs of declarations and expressions by a
macro returning a begin form.  This seems to me a good and worthy thing
to be able to do.

Eliminating the distinction between library bodies and toplevel bodies
also allows a simplification in both description and understanding.

-- 
He played King Lear as though           John Cowan <cowan at ccil.org>
someone had played the ace.             http://www.ccil.org/~cowan
        --Eugene Field




More information about the r6rs-discuss mailing list