[plt-scheme] why does local-expand leave letrec-syntaxes+values

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Fri Mar 10 15:22:06 EST 2006

On Fri, 2006-03-10 at 13:02 -0700, Matthew Flatt wrote:
> At Fri, 10 Mar 2006 13:49:22 -0500, Sam Tobin-Hochstadt wrote:
> > Local-expand, when expanding a letrec-syntaxes+values, expands the body
> > using the declared syntax expanders, but leaves the letrec-syntaxes
> > +values in place, whereas expand transforms it into a letrec-values.
> > Why is this?
> Because `local-expand' is normally used with "stop" bindings that leave
> sub-expressions unexpanded, whereas `expand' fully expands all
> expressions.
> It's possible that `local-expand' could handle specially the case of an
> empty stop list, but I'm not sure that would always work right, since
> the result of `local-expand' is typically fed back to the macro
> expander (as a sub-expression of a macro result).

I realize all this, and my use of null as the stop list was just for the
purposes of the example.  But if letrec-syntaxes+values is not in the
stop list, why shouldn't it be expanded?  For example, let-syntax and
letrec-syntax both get transformed into letrec-syntaxes+values by
local-expand, unless they are in the stop list.  Why is letrec-syntaxes
+values different?


sam th

Posted on the users mailing list.