<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body>
Your problem in this example is that call-it is only provided from
caller to test. test has to provide it again if it wants it to find its
way to the top level.<br>
<br>
Methinks that eval-string, like eval, works with current-namespace. You
can create a new namespace (not sure what function does that) and put
call-it in the environment using (eval `(define call-it ,call-it)).
Then you would be able to call call-it even if it is not in the top
level.<br>
<br>
Yours,<br>
Katsmall T. Wise, Esquire<br>
<br>
<br>
Paulo Jorge de Oliveira Cantante de Matos wrote:<br>
<blockquote type="cite" cite="mid1059568426.4118.8.camel@localhost">
<pre wrap=""> For list-related administrative tasks:
<a class="moz-txt-link-freetext" href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a>
Hi again,
Ok, my situation seems now to be even worse.
I've provided all my functions, still I'm not able to call them from
toplevel. Check the following simple example:
caller.scm:
(module caller mzscheme
(require "test.scm")
(define (call-it)
(bar))
(provide call-it))
test.scm:
(module test mzscheme
(require (lib "string.ss"))
(define (foo)
(eval-string (read-line)))
(define (bar)
(display "Done"))
(provide foo bar))
Now I execute caller.scm:
</pre>
<blockquote type="cite">
<pre wrap="">(require "caller.scm")
(call-it)
</pre>
</blockquote>
<pre wrap=""><!---->(bar)
. . reference to undefined identifier: bar
Why can't I call bar if they are on toplevel (since I provided them)?
Can't foo and bar be inside a module for me to call them?
Best regards,
Paulo Matos
</pre>
<blockquote type="cite">
<pre wrap="">From: Robby Findler <a class="moz-txt-link-rfc2396E" href="mailto:robby@cs.uchicago.edu"><robby@cs.uchicago.edu></a>
To: Paulo Jorge de Oliveira Cantante de Matos <a class="moz-txt-link-rfc2396E" href="mailto:pocm@mega.ist.utl.pt"><pocm@mega.ist.utl.pt></a>
Cc: PLT Scheme ML <a class="moz-txt-link-rfc2396E" href="mailto:plt-scheme@list.cs.brown.edu"><plt-scheme@list.cs.brown.edu></a>
Subject: Re: [plt-scheme] eval-string namespace
Date: Tue, 29 Jul 2003 16:24:20 -0500
When you provide bar, the `require' is putting bar into the toplevel
namespace. Also, when you call eval-string, that code will refer to the
toplevel namespace. If you don't provide bar, then it won't be in the
toplevel namespace, so the eval-string won't find it.
The point here is that `eval-string' is not lexically sensitive in any
way. It always compiles free identifiers in the input expression to
refer to the toplevel -- not the place where the eval-string was
called.
Robby
At 29 Jul 2003 22:15:29 +0000, Paulo Jorge de Oliveira Cantante de
Matos wrote:
</pre>
<blockquote type="cite">
<pre wrap=""> For list-related administrative tasks:
<a class="moz-txt-link-freetext" href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a>
Hi all,
Check the following:
(module test mzscheme
(require (lib "string.ss"))
(define (foo)
(eval-string (read-line)))
(define (bar)
(display "Done"))
(provide foo))
If I run this, require test.scm and enter bar for read-line I get
</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->that
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">bar is undefined. But it'll work alright if I provide bar. Why?
I don't understand this behaviour, it's definitely not what I
</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->expected.
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">In the manual there is no mention to this situation, which is I might
say strange and boring since I have in the module 20 functions that
</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->can
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">be called through eval-string that I don't want to provide.
Any suggestions?
Best regards,
Paulo J. Matos
</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
</body>
</html>