[plt-scheme] let-syntax bug


Thu Mar 26 00:47:06 EDT 2009


On Thu, 8 Apr 2004, Bradd W. Szonye wrote:

>     (let-syntax ((foo ...))
>       (define-syntax bar (syntax-rules () ((bar) 'hello))))
> 
> The syntactic binding of BAR is clearly nested inside FOO's region.
> Migrating BAR outside of the LET-SYNTAX region would clearly break
> syntactic scoping, which is IMO a very, very bad idea.

Except that "internal definitions" are already allowed in transformer
templates.   

In regular Scheme, the following

  (define f 
    (lambda () expr)

  (f)            

gives the same answer as 

  (letrec ((f (lambda () expr)))
    (f))         

In analogy, my expectation would therefore be that 

  (define-syntax f
   (syntax-rules ()
     ((f) expr))))

  (f)

should give the same as 

  (letrec-syntax ((f (syntax-rules () expr)))
    (f))

However, this is not the case when expr is an internal define-syntax.  







More information about the plt-scheme mailing list