[racket] `namespace-set-variable-value!` doesn't "shadow"? How to do?

From: Greg Hendershott (greghendershott at gmail.com)
Date: Sun Nov 24 16:20:56 EST 2013

> 1. Is there a way to make `namespace-set-variable-value!` "shadow", generally?

It looks like the answer is "no", if I were to actually RTFM:

"Sets the value of sym in the top-level environment of namespace in
the base phase, defining sym if it is not already defined."

Last 6 words = No.

> 2. If not, how can I at least shadow a specific symbol, such as `date`?

Looks like it must be done this way -- excluding racket/base's `date`
from the namespace in the first place.

Ordinarily this would be easy. e.g. If in template.rkt I add `(require
(except-in net/url get-pure-port))` and make a template variable
`'get-pure-port`, that works. There's no collision because it's not in
the namespace to begin with (at least I think that's why).

But `date` comes from racket/base, which is on the #lang line.

As a result, I think my question is actually, "How to do the
equivalent of an `except-in` for #lang racket/base"??

1. Am I asking the right question?

2. If so, what's the answer?

Posted on the users mailing list.