Hi all, hi Matthias,<div><br></div><div>I would like to come back to my (still unsolved) problem I </div><div>proposed some days ago:</div><div><br></div><div>when using define-syntax in a inner scope of bindings (like let),</div>
<div>in this example:</div><div><br></div><div><div><div>(define-syntax mymacro</div><div> (syntax-rules ()</div><div> [(_ x)</div><div> (eval `(lambda (w) (print (quote x)) (if x w #f)))]))</div></div></div><div>
<br></div><div>(let* ((s 3) (f (mymacro (> s 0)))) (f 5))</div><div>reference to undefined identifier: s</div><div><br></div><div>of course if you:</div><div><br></div><div>(define s 3)</div><div><br></div><div>in the top environment, the error will not appear.</div>
<div>This is even more clear if you expand the macro:</div><div><br></div><div>(syntax->datum (expand '(mymacro (> s 0))))</div><div>... you see that "s" is a %top binding.</div><div><br></div><div>I know that if I make the macro to return directly the lambda,</div>
<div>it works. Nevertheless, in my implementation, I still need to use</div><div>the "(eval (quasiquote (lambda ...)))". </div><div>Why? my macro is like a compiler</div><div>that generates a lambda code very huge: the code is recursive in some of its part,</div>
<div>but, for efficiency reasons, i preferred to inline all recursive calls. So I use a</div><div>function "expander" that makes recursive inlining (or injecting) of code).</div><div>It is more or less something like:</div>
<div><br></div><div>`(lambda (...) ... static-code... ,(expander ...) ...)</div><div><br></div><div>where "expander call itself with different parameters.</div><div> </div><div>This is just to know your opinion... if the "(eval (quasiquote (lambda ...)))"</div>
<div>cannot see local bindings like in let*, than I have to choice:</div><div>1) renounce to the feature.</div><div>2) looking for alternative methods to generate my code with recursive inlining</div><div><br></div><div>Than you,</div>
<div>Cheers,</div><div>Maurizio.</div><meta http-equiv="content-type" content="text/html; charset=utf-8">