<div dir="ltr">Hi -<br><br>are there specific rules that governs the choice of context to datum->syntax? I'm finding that the choices of the context impacts whether the name can be captured, and are not seeing what the issues are... <br>
<br>Below are two versions of `if-it` - the first version works with #'_, but the second version cannot work with it (it works with #'test).<br><br>Any pointers are appreciated, thanks.<br>yc<br><br><div style="margin-left: 40px; font-family: courier new,monospace;">
(define-syntax (if-it stx)<br> (syntax-case stx ()<br> ((_ test then else)<br> (with-syntax ((it<br> (datum->syntax #'_ <br> 'it)))<br> #'(let ((it test))<br>
(if it test else))))))<br><br>(if-it '(abc def) it 'nil) ;; works <br><br>(define-syntax (if-it1 stx)<br> (syntax-case stx ()<br> ((_ test then else)<br> (with-syntax ((it<br> (datum->syntax #'_ ;; doesn't work... works if replaced with #'test<br>
'it)))<br> #'(let ((it test)) <br> (if it then else)<br> )))))<br><br>(if-it1 '(abc def) it 'nil) ;; => reference to undefined identifier: it<br>
</div><br></div>