[plt-scheme] full-expanded syntax and internal definitions

From: Ryan Culpepper (ryanc at ccs.neu.edu)
Date: Mon Aug 6 03:57:45 EDT 2007

On Sun, 2007-08-05 at 14:05 -0400, Dave Herman wrote:
> > No, so there no local macro definitions in fully expanded code.
> 
> If that's true then this must mean that local-expand is not guaranteed 
> to produce fully-expanded code?

That's right. If you give 'local-expand' a non-empty stop list, of
course it may return code with macros left in it. And if there are still
macros in it, it's not safe to remove any local macro definitions. So
'local-expand' never removes local macro definitions, rather than
treating the empty stop list case specially.

Ryan

> 
>  > (define-syntax (quote-expand stx)
>      (syntax-case stx ()
>        [(_ e)
>         (with-syntax ([exp (local-expand #'e 'expression '())])
>           #'(quote exp))]))
>  > (quote-expand (lambda ()
>                    (define-syntax foo (syntax-rules () [(_) 42]))
>                    (define y 10)
>                    y))
> (lambda () (letrec-syntaxes+values (((foo) (syntax-rules () ((_) 42)))) 
> (((y) (#%datum . 10))) y))
> 
> Dave
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.