[plt-scheme] namespace question

From: Chris Wright (caw at cs.mu.oz.au)
Date: Tue Oct 7 02:13:42 EDT 2003

OK. Thanks.
I was confused (on top of my intrinsic confusion) by
(namespace-set-variable-value! symbol v [map?]) sets the value of 
symbol in the top-level environment of the current namespace, defining 
symbol if it is not already defined.

all those mentions of "defining" made me think it would behave like, 
um, "define"

 > (define a 3)
 > a
3

and not require quotation...

thanks again

chris

On Tuesday, Oct 7, 2003, at 15:56 Australia/Melbourne, Eli Barzilay 
wrote:

>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> 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!
>
>
Dr. Chris Wright
Medical Director
Intensive Care Unit
Monash Medical Centre, Clayton VIC



Posted on the users mailing list.