Hello,

I want to shadow instead of mutate. 

The ideal solution would be to create a new environment that extends the old 
one, so that new definitions in the new environment shadow the old definitions 
instead of mutating them.

But if that isn't feasible with the way namespaces work right now, is there a 
way to copy a namespace so that mutating the copy doesn't mutate the original? 
If there isn't, is there a way to functionally update a namespace to add new 
definitions?

I need this for my debug-repl package so I avoid mangling the namespace in 
examples like this:

> (define x 1)
> x
1 ; outside the debug-repl, x is 1
> (define (f x) (debug-repl))
> (f 2)
-> x
2 ; inside the debug-repl, x is 2
-> ; exit the debug-repl
> x
2 ; x should be 1, but it mangled the namespace

Is there a way to do this without mangling the original namespace?

Alex Knauth

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to