Why do you need to syntax rather than just quote the (define-syntax ...) before giving it to eval? Or would either work...?<br><br><div class="gmail_quote">On Dec 14, 2007 8:20 AM, Matthew Flatt <<a href="mailto:mflatt@cs.utah.edu">
mflatt@cs.utah.edu</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">At Fri, 14 Dec 2007 17:10:30 +0100, "Jos Koot" wrote:
<br>> (define (add-binding name transformer)<br>> (eval #`(define-syntax #,name #,transformer) namespace))<br>><br>> (add-binding 'name (syntax-rules () ((_) (list 'transformer))))<br></div>> [...]
<br><div class="Ih2E3d">><br>> (define (add-binding name transformer)<br>> (eval #`(define-syntax #,name #,transformer) namespace))<br>><br>> (add-binding #'name (syntax-rules () ((_) (list 'transformer))))
<br></div>> ^^^^^^<br><br>Yes, these are different in the specific case of binding 'name, since a<br>symbol to `add-binding' is coerced to a syntax object using the lexical<br>context of the `quasisyntax' expression --- and that context includes a
<br>local binding of `name'.<br><br><br>I should have suggested<br><div class="Ih2E3d"><br> (define (add-binding name transformer)<br></div> (with-syntax ([name (datum->syntax #f name)])<br> (eval #`(define-syntax name #,transformer))))
<br><br>to avoid that particular pitfall.<br><font color="#888888"><br><br>Matthew<br><br></font></blockquote></div><br><br clear="all"><br>-- <br>Dan Liebgold [<a href="mailto:dan.liebgold@gmail.com">dan.liebgold@gmail.com
</a>]