<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">A workaround depends on what you are trying to do. For example, providing a function to evaluate a string works, but you also have to provide any function you intend to use.<DIV><BR class="khtml-block-placeholder"></DIV><DIV>(module foo mzscheme</DIV><DIV> (define (abc x)</DIV><DIV> (display "foo")</DIV><DIV> (newline))</DIV><DIV> </DIV><DIV> (define (eval-string-with-1 string)</DIV><DIV> ((eval (string->symbol string)) 1))</DIV><DIV> </DIV><DIV> (provide eval-string-with-1</DIV><DIV> abc)</DIV><DIV> )</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>(require foo)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>(eval-string-with-1 "abc")</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>rac</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR><DIV><DIV>On Jun 23, 2007, at 8:56 AM, Jean-Pierre Lozi wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite">Hi all,<BR><BR>How can I use eval in a module definition? For instance, <BR><BR>(define (abc x)<BR> (display "foo")<BR> (newline))<BR><BR>((eval (string->symbol "abc")) 1)<BR><BR>works, whereas<BR><BR> (module foo mzxcheme<BR> (define (abc x)<BR> (display "foo")<BR> (newline))<BR> <BR> ((eval (string->symbol "abc")) 1))<BR><BR>(require foo)<BR><BR>doesn't. Eval appears too look for the abc function in the global namespace. Does anyone know a workaround?<BR><BR>Thanks,<BR><BR clear="all"> <BR>-- <BR>Jean-Pierre Lozi<BR><A href="http://www.lozi.org">http://www.lozi.org</A><BR>mailto:<A href="mailto:jean-pierre@lozi.org">jean-pierre@lozi.org</A><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_________________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN>For list-related administrative tasks:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN><A href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</A></DIV> </BLOCKQUOTE></DIV><BR></DIV></BODY></HTML>