[plt-scheme] namespace question
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!