[racket] Why begin0 doesn't expands to begin ?

From: Gustavo Massaccesi (gustavo at oma.org.ar)
Date: Fri Dec 14 22:06:12 EST 2012

The "begin" and "begin0" forms appear in the racket programs, in the
fully expanded programs and in the bytecode. I expected that in some
intermediate expansion step the "begin0" form expands to a "begin"
form.

For example something like: (This version doesn't work for multiple
return values.)

(define-syntax-rule (my-begin0 first rest ...)
  (let ([temp first])
     rest ...
    temp))

With this expansion the number of different kinds of operations in the
bytecode /virtual machine is smaller, so it would be easier to
maintain and optimize.

My question is: Is this a bad idea because there is a special
optimization for the "begin0" form?

Gustavo

Posted on the users mailing list.