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

Re: [Scheme-reports] Buggy definition of BEGIN



Andre van Tonder <andre@x> writes:

> On p 56, the definition of BEGIN is buggy:
> 
> (define-syntax begin
>    (syntax-rules ()
>      ((begin exp ...)
>      ((lambda () exp ...)))))
> 
> because with this definition we get the following error:
> 
>    (let ((x 1))
>      (begin (define x 2))
>      x)                     ===> 1 (ERROR!!)
> 
> QED

This only defines (begin <expression1> <expression2> ...)  of section
4.2.3. It should never be used to handle a (begin <definition>).

There are at least three other (begin <something> ...) forms in the
language now: 5.1. specifies a splicing program-level begin where
<something> can be any form, 5.2.2. specifies a splicing (begin
<definition1> ...) that can occur whereever an internal definition
can, and 5.5.1. specifies the module form (begin <command or
definition> ...). None of these are expression types.

I would say the definition on p. 56 is all right, but section
4.2.3. should at least mention that there are other, different, begin
forms in the language.


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