[plt-scheme] Shadowing imported bindings

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Oct 24 13:20:58 EDT 2003

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



Posted on the users mailing list.