[plt-scheme] Shadowing imported bindings
At Fri, 24 Oct 2003 10:12:02 -0700, "Bradd W. Szonye" wrote:
> In PLT Scheme, imported bindings cannot be set! or shadowed. For
> example, the following module is illegal:
>
> (module foo mzscheme
> (set! + my-plus)
> (define + my-plus))
>
> I understand why set! is not permitted, by why is rebinding (shadowing)
> also disallowed?
> [...]
> It seems to me that shadowing would be simpler from the user's point of
> view, but it might cause problems with "what does this code really
> mean?" since module bindings cover the entire module scope.
That's it exactly. Multiple definitions/imports of a identifier are
disallowed for the same reason that multiple bindings of an identifier
are disallowed in "letrec".
It was a conscious choice, and many other choices rely on this one
(e.g., the fine point of partial expansion, as used in the body of
`unit', `class', or `package' to distinguish definitions from
expressions).
Matthew