[racket] syntax-case literals matching in a procedure defined via begin-for-syntax vs (require (for-syntax ...))

From: YC (yinso.chen at gmail.com)
Date: Tue Aug 10 14:05:31 EDT 2010

On Mon, Aug 9, 2010 at 4:35 PM, Ryan Culpepper <ryanc at ccs.neu.edu> wrote:

>
>  2) when (require (for-syntax)) is used - the function was defined in phase
>> 0, but is imported into phase 1... would it not handle syntax matching at
>> phase 0?
>>
>
> When require for-syntax is used, the module where the literal occurs is at
> phase 1, so it only has a binding for the literal at phase 1. (The function
> is at phase 0 *relative to its enclosing module*, but it's at "absolute"
> phase 1.) Adding the require for-template (relative phase -1) to the
> auxiliary module (at phase 1) adds a binding at the right absolute phase, 0.
>
>
Thanks Ryan.  I think I more or less get the idea of phase shifting now.  It
would seem that if I ever define such function at phase 0, adding (require
(for-template)) will and should be automatic going forward.

Thanks again.
yc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100810/323af1d1/attachment.html>

Posted on the users mailing list.