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

Re: [Scheme-reports] Please make internal BEGIN a splicing form



On Mon, Apr 25, 2011 at 12:51 AM, Andre van Tonder <andre@x> wrote:
> On Sun, 24 Apr 2011, Jussi Piitulainen wrote:
>
> Why can't internal BEGIN be a splicing form as in R6RS?  There is
> no good reason why
>
>    (let ()
>      (begin (define-syntax .....)
>             (define ............)
>             <expression>)
>
> shouldn't work fine.

Internal BEGIN is a splicing form, and you can use it to
expand multiple syntax definitions or normal definitions,
optionally expanded from other macros like define-record-type.

The rationale for requiring the syntax definitions appear
before normal definitions is in part compatibility with the
R5RS restriction that definitions precede expressions,
and in part because I didn't want to touch the R6RS
semantics with a 10 foot pole. The example given in
R6RS is:

  (let ()
    (define even?
      (lambda (x)
        (or (= x 0) (odd? (- x 1)))))
    (define-syntax odd?
      (syntax-rules ()
        ((odd?  x) (not (even? x)))))
    (even? 10))                               => #t

which is a terrible programming style to
encourage, and may be prohibitively difficult
for some existing R5RS implementations.

-- 
Alex

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