<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16414" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>Hi Wayne,</DIV>
<DIV>I regret my earlier posting on using namespace-set-variable-value! for
setting variables whose names are determined at run time. Your code does
not work because modules are separated from top level namespaces. That's
(among other things) what makes modules safe. The following works, but are
you sure you want this? Better suggestions for runtime bookkeeping of
symbol/value associations have already been posted. IMHO it (usually)
is better to forget the top level alltogether and to think in terms of
modules only. I know from bad experiences that the toplevel is tricky.</DIV>
<DIV>Jos Koot</DIV>
<DIV> </DIV>
<DIV>(module lang mzscheme<BR> (printf "defining~n")<BR>
(namespace-set-variable-value! 'f 1))</DIV>
<DIV> </DIV>
<DIV>(module test mzscheme<BR> (require lang) ; does the top level
assignment (once only)<BR> (provide (all-defined))<BR> (define
(test1) (namespace-variable-value 'f))) ; refers to the top level</DIV>
<DIV> </DIV>
<DIV>(require test) ;; prints
defining<BR>(test1) ;; -->
1<BR>(require lang) ;; does nothing</DIV>
<DIV> </DIV>
<DIV>(((((lambda(x)((((((((x x)x)x)x)x)x)x)x))<BR>
(lambda(x)(lambda(y)(x(x y)))))<BR> (lambda(x)(x)x))<BR>
(lambda()(printf "Greetings, Jos~n"))))</DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=support@taxupdate.com
href="mailto:support@taxupdate.com">support@taxupdate.com</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=plt-scheme@list.cs.brown.edu
href="mailto:plt-scheme@list.cs.brown.edu">plt-scheme@list.cs.brown.edu</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, April 27, 2007 12:21
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [plt-scheme]
namespace-variable-value</DIV>
<DIV><BR></DIV>Based on my understanding of the section "8.3 Namespace
Utilities" from the<BR>docs, I was expecting the following to print a
"1":<BR><BR>(module lang mzscheme<BR> (provide
(all-defined)<BR>
(all-from mzscheme))<BR> (define f 1))<BR><BR>(module test
lang<BR> (provide (all-defined))<BR> (define
(test1)<BR> (display (namespace-variable-value
'f))))<BR><BR>(require test)<BR>(test1) ;;
"namespace-variable-value: f is not defined"<BR><BR>Why doesn't the call to
namespace-variable-value in module test
succeed?<BR><BR>Wayne<BR>_________________________________________________<BR>
For list-related administrative tasks:<BR> <A
href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</A><BR></BLOCKQUOTE></BODY></HTML>