[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: R5RS draft: <body> in LET{REC}-SYNTAX ???
> I don't see the problem here. Richard Kelsey wrote:
> > But there is some confusion. We (or at least I) would
> > like to allow LET{REC}-SYNTAX forms that are at top level
> > to expand into a sequence of definitions that are spliced
> > into the program. This would be disallowed if the usual
> > `expressions are evaluated in order and the value(s) of
> > the last one is returned' language were used. Splicing a
> > list of commands into a program has a perfectly reasonable
> > semantics, and is already done with BEGIN.
> Why can't a person who wants a LET{REC}-SYNTAX form to expand
> into a sequence of definitions D1, ... just write the form so
> it expands into (BEGIN D1 ...) instead? This will work in every
> context that admits a sequence of definitions.
We may not all be talking about the same thing, but in particular,
the following is not legal:
(let-syntax () (begin (define foo 3) (define bar 4)))
because the let-syntax (unnecessarily) introduces a new scope, ala let.
If let-syntax were valid as a definition and simply produced a form or
a sequence of forms implicitly wrapped in a begin, so that, for example,
(let-syntax () D ...) were equivalent to (begin D ...), one could write:
(let ()
(define x 3)
(let-syntax ((alpha (syntax-rules () ((_) (+ x 1)))))
(define y (alpha)))
(+ x y))
As it is, this is invalid. But this is probably an R6RS issue.
Kent