[plt-scheme] redefinition in module

From: Robby Findler (robby at cs.uchicago.edu)
Date: Fri Feb 29 16:44:24 EST 2008

A few minor points to add to the stew: "#lang scheme" should hopefully
change at about the rate the old mzscheme language changed (ie, not
that often) so I hope that that won't be a problem, but "#lang
scheme/base" shoudl change much less frequently than that, so if you
want to be careful about your imports, you might consider using it
instead (and importing what you need beyond it).

As far as scope goes, the module system treats all requires (including
the require of "scheme") as being in the same scope as the definitions
in a module (after all, you can interleave them). So, that program is,
in some sense, like this one: (letrec ((add1
the-original-mzscheme-add1) (add1 sub1)) ...)


On Fri, Feb 29, 2008 at 1:04 PM, Jos Koot <jos.koot at telefonica.net> wrote:
> #lang scheme (let ((add1 sub1)) (add1 3))
> is perfecttly alright.
> #lang scheme (define add1 sub1) (add1 3)
> is not accepted.
> Why?
> The redefinition does no harm to any other imported procedure or macro.
> That's the beauty of modules: being sure that your macros and procedures
> cannot be corrupted by invoking modules.
> The restriction forces me to rename procedures and syntaxes previously not
> present, but now provided by #lang scheme.
> For example, I had my own nice and more general version of syntax 'for'. I
> no longer can import my own 'for' without renaming.
> And I have to rename every invocation of my for in all modules requiring my
> nice 'for'.
> I think that redefinitions in a module must be allowed and must be
> considered to be local to the module.
> Now what happens:
> 1: You have a fine #lang scheme program.
> 2: You download a new scheme whose #lang scheme happens to include a 'new'
> procedure or syntax with the same name as used in your nice program.
> 3: Or one of the required modules happens to do that.
> 4: The program no longer can be compiled.
> Why? This is very much against the principle of scope, I think.
> I cannot think of any implementation problem.
> Jos Koot.
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.