[plt-scheme] checking my macro understanding.

From: John Clements (clements at brinckerhoff.org)
Date: Thu Feb 8 15:45:14 EST 2007

If anyone has 30 seconds, I want to make sure I understand what's  
going on here and why:

(module provides-a mzscheme
   (provide a)
   (define-syntax (a stx)
     (syntax-case stx ()
       [(_ x) #`(+ x 13)])))

(module expands-into-requirer mzscheme
    #`(module foo mzscheme
        (require provides-a)
        (display (a 10))

(require expands-into-requirer)

This causes an error on an unbound "a" in the call to display.  

[bug icon] expand: unbound variable in module in: a

My understanding is that this occurs because the context of the hash- 
quote is that of the module expands-into-requirer, where 'a' is not  
bound to a macro.  However, I can make this code run (I tried it) by  
using datum->syntax-object to defeat the hygiene bindings.

Broadly, if I want to expand into a module form, I need to be careful  
to defeat hygiene wherever I want to embed code that refers to macros  
that are imported into the module.  Is this correct?

Thanks in advance; I'm sure that the manual
John Clements

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2484 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20070208/6b237c74/attachment.p7s>

Posted on the users mailing list.