[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Restrictions on internal BEGIN?



Andre van Tonder <andre@x> writes:

> The description on p. 19 suggests that only internal definitions can
> be in an internal BEGIN.  The formal syntax suggests that syntax
> definitions can also be in an internal BEGIN, but according to the
> formal syntax we canot mix syntax and ordinary definitions in an
> internal BEGIN.  So are all of the following illegal?
> 
> (let ()
>    (begin 1))

That's the (begin <expression1> <expression2> ...) expression from
4.2.3., not the (begin <definition> ...) that can occur at the
beginning of a <body>.

But I notice that the descriptions of let, let*, ... in 4.2.2. say
just "<body> should be a sequence of one or more expressions" without
allowing for initial definitions at all. This contradicts 5.2.2.

> (let ()
>    (begin
>      (define x 1)
>      x))

That would be the splicing (begin <form> ...) top-level form from
5.1., only recognised on program top-level, so illegal.

> (let ()
>    (begin
>      (define-syntax foo .......)
>      (define x 1))
>     1)

I think this should be allowed. Checking 5.2.2. and 5.3. seems to
agree with it: syntax definitions are valid whereever definitions are
valid, and a (begin <definition> ...) can be initial to a <body>.

The formal syntax says otherwise and keeps syntax definitions separate
from definitions in <body>, <definition> and <syntax definition>.


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