[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Pika-dev] Problem with Pika's macro expander?
From: |
Tom Lord |
Subject: |
Re: [Pika-dev] Problem with Pika's macro expander? |
Date: |
Wed, 25 Feb 2004 09:47:54 -0800 (PST) |
> From: Matthew Dempsky <address@hidden>
> > `(letrec "gtn"
> > ,y...
> > ,temp...
> > ,var1-init...
> > ,@ body...))
> I think you actually meant (let bindings omitted):
>
> `(letrec "gtn"
> ,y...
> (,_newtemp_ ,@temp...)
> ,var1-init...
> ,@ body...))
Right.
> Also, for the record, I'd like to point out that there should be just
> one call to hygenic-binding-of per symbol when expanding a
> syntax-rules clause. For example, the following clause is part of the
> R5RS syntax-rules definition of OR:
>
> ((or test1 test2 ...)
> (let ((x test1))
> (if x x (or test2 ...))))
> It's important to expand that into:
>
> (let ((test1 (cadr exp))
> (test2... (cddr exp))
> (_let (hygenic-binding-of let))
> (_x (hygenic-binding-of x))
> (_if (hygenic-binding-of if))
> (_or (hygenic-binding-of or)))
> `(,_let ((,_x ,test1))
> (,_if ,_x ,_x (,_or ,@test2...))))
> rather than:
> (let ((test1 (cadr exp))
> (test2... (cddr exp))
> (_let (hygenic-binding-of let))
> (_x1 (hygenic-binding-of x))
> (_x2 (hygenic-binding-of x))
> (_x3 (hygenic-binding-of x))
> (_if (hygenic-binding-of if))
> (_or (hygenic-binding-of or)))
> `(,_let ((,_x1 ,test1))
> (,_if ,_x2 ,_x3 (,_or ,@test2...))))
> I doubt the above would be a likely expansion that anyone would
> generate, but equivalent semantics might be formed by a naive
> implementation.
Right.
-t