[plt-scheme] namespace question

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Oct 7 01:56:28 EDT 2003

On Oct  7, Chris Wright wrote:
> [...]
> (let ([n (make-namespace)])
>    (parameterize ([current-namespace n])
>      (ns/set! y 'wft)
>      (eval '(display y))))
> 
> results in : "reference to undefined identifier: y"
> 
> so, obviously, I don't understand namespace-set-variable-value!
> enlightenment (or, rather, an explanation... I may never achieve 
> enlightenment...:) would be appreciated

It's a function, not a special form, so it expect an identifier name:

  (let ([n (make-namespace)])
    (parameterize ([current-namespace n])
      (ns/set! 'y 'wft)
      (eval '(display y))))

Note that if you do this:

  (let ((y 'x))
    (let ([n (make-namespace)])
      (parameterize ([current-namespace n])
        (ns/set! y 'wft)
        (eval '(display y)))))

you get the same error, but from a different place (DrScheme will show
you that).

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.