Hi all - <br><br>at the risk of beating this point (<a href="http://list.cs.brown.edu/pipermail/plt-scheme/2007-April/017471.html">http://list.cs.brown.edu/pipermail/plt-scheme/2007-April/017471.html</a>) to death, I've found that a possible issue is that my macro doesn't seem to do what I expected... namely add an automatic prefix to a required lib. Any pointers are greatly appreciated.
<br><br>What I am trying to write... <br><br>(require-prefix (lib "test.ss" "test")) <br><br>Which should expand out to <br><br>(require (prefix test.test.ss: (lib "test.ss" "test")))
<br><br>But it isn't working... I've simplify the test code to add a static prefix (a:) rather than automatically generating a prefix but still have issues - I thought with-syntax would ensure the prefix gets expanded with the correct syntax-info, but there must be other points that I don't understand that currently escaped me on why this macro doesn't work...
<br><br> (define-syntax require-prefix <br> (lambda (stx) <br> (syntax-case stx () <br> ((_ req-clause) <br> (with-syntax ((pref (datum->syntax-object stx (string->symbol "a:")))) <br>
#`(require (prefix pref req-clause))))<br> ((_ req-clause rest ...) <br> #'(begin <br> (_ req-clause)<br> (_ rest ...)))))) <br><br>;; REPL<br>> (require-prefix (lib "
string.scm" "util"))<br>> a:substr<br>Error. reference to undefined identifier: a:substr<br>> (require (prefix a: (lib "string.scm" "util")))<br>> a:substr <br>#<procedure:substr>
<br><br>Thanks,<br>yinso <br>
<br><br><br><br><br>