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 99: Allow top-level LET-SYNTAX

2010-11-18 14:14:34
WG1 - Core
alexshinn
major
cowan
duplicate
source
closed
2010-11-17 06:09:06
defect

Email from Thomas Bushnell:

Ah. The usage case is where I want to have a top-level macro which expands into a series of top-level forms. For example, suppose I want define-many which looks like this:

(define-many foo bar baz quux)

and expands into:

(define foo #f) (define bar #f) (define baz #f) (define quux #f)

However, syntax-rules doesn't permit a series of forms, so the R5RS solution is to put a begin around it, and then specify that begin doesn't change the top-level-ness of the forms inside it. So this works:

(define-syntax define-many (syntax-rules () ((_ name names ...) (begin (define name #f) (define names #f) ...))))

So far so good. But suppose now that the forms inside all need to make use of some special bit of local syntax. That is, I want to define some syntax which will not be visible at top-level, but will be used by the forms that define-many expands into. The solution should be to replace begin with let-syntax above, but you can't do it according to R5RS. Most Scheme folks that I know regard this as a bug, because a top-level let-syntax really can't have any other use.

resolutionduplicate
statusnewclosed

let-syntax is allowed at top-level, as is any Scheme expression. Using let-syntax to expand into definitions is a grey area, already brought up by #48.