[plt-scheme] Re: cannot require 19.ss (srfi)

From: Hans Oesterholt-Dijkema (hdnews at gawab.com)
Date: Thu Jan 6 16:06:07 EST 2005

> Suppose the module system did override conflicting names quietly.
> Consider now the situation, where you
> require the library A in order to use the function foo, and require the
> library B in order to use bar. To your
> great surprise something unexpected happens when using foo. What
> happened? The library B incidently
> also exported a function named foo (which you wasn't aware of, since 
> it was written by a friend), and thus overrided the foo from A. Such 
> a bug could be very time consuming to find.

I see your argument, and can imagine this to some degree.
However, there are other ways to tackle this.
E.g. bigloo only complains about overriding a primitive or function,
but doesn't stop working. As bigloo actually compiles to C, it
doesn't need a '--quit' flag to stop complains from occuring
in "production code".

 
> 
>   (module foo mzscheme
>     (require (lib "1.ss" "srfi")))
> 
> will give the error
> 
>     "module: identifier already imported (from a different source) 
> in: reverse!"
> 
> There are several solutions:
> 
>   1. Import all of the srfi-1 except reverse! (and the other 
> redefined names),      then import the remaining names one at time,
>  while renaming them.
> 
>   2. Use another language than mzscheme for your module.


3. If I'm correct it is also possible to redefine the
   original primitives using some special construct.


> 
> 
> --
> Jens Axel Søgaard


Thanks for your elaborate answer!


-- 
Hans



Posted on the users mailing list.