[racket] Creating ids from symbols

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Aug 5 10:09:50 EDT 2011

At Fri, 5 Aug 2011 15:04:42 +0100 (BST), Mark Carter wrote:
> It doesn't quite work:
> 
> (define foo 42)
> (define bar 'foo)
> (namespace-set-variable-value! bar 43)
> foo ; => 42, but I want it to be 43

Those 4 lines in a REPL produce 43, but my guess is that you have the
code in a module.

In a module, you'll need to manage the namespace more explicitly (or
maybe reflection won't be the way to go after all).

See

  http://docs.racket-lang.org/guide/reflection.html

for more information about namespaces.



Posted on the users mailing list.