infelicity in module imports

Brian Boutel brian@boutel.co.nz
Fri, 13 Jul 2001 09:07:15 +1200


Wolfgang Lux wrote:
> 
> Brian Boutel wrote
> 
> > Option 2 is closer to what the syntax of imports, read as English, suggests
> > is intended, but, if it wasn't for that, I'd be promoting option 1.
> > The primary purpose of being able to restrict imports is to avoid name
> > clashes, and with qualified import there is no risk of a clash, so no need
> > for restrictions.
> 
> This is not true since Haskell allows for the renaming of modules on
> imports. If you look at the example in section 5.3.2 of the report,
> there is the example
> 
>   module M where
>     import qualified Foo as A
>     import qualified Bar as A
>     x = A.f
> 
> Obviously there is a name clash if both, Foo and Bar export symbol f.
> 

Obviously you can rename modules to create a name clash, but it seems a
silly thing to do.

What I was trying to say was that in

     module M where
       import  Foo 
       import  Bar hiding f

where both Foo and Bar export f, there is no reason to not import all
the qualified names in Bar, because no name clash will result if you do.

However, this argument is now moot, becaue the resolution of this issue
is now clear, and is good enough.

 --brian