Module re-exportation weekend puzzler
Simon Peyton-Jones
simonpj@microsoft.com
Tue, 5 Nov 2002 10:07:36 -0000
Folks
Another minor H98 glitch. Consider this:
| > > module D (module Char) where
| > > { import qualified Char; import List as Char }
| >
| > Everything in List, nothing from Char.
|=20
| Interesting... what happens when List and Char overlap here? Suppose
| there exists entities List.f and Char.f, then it would be an error to
| refer to Char.f in the body of the module. On export lists, the
report
| says:
|=20
| The form "module M" names the set of all entities whose
| unqualified name, e, is in scope, and for which the qualified
| name M.e is also in scope and refers to the same entity as e.
|=20
| Perhaps this could be clarified by insertion of the word
"unambiguously"
| before "refers to the same entity as e". It's not essential, but it
| would make the expected behaviour in this case clearer.
I agree with this. (Actually GHC gets it wrong right now.) Another
way to say it is this:
The export item 'module M' exports all entities e such that
a) The qualified name M.e is unambiguous and refers to that
entity
b) The unqualified name e is in scope, perhaps ambiguously, and
at least=20
one of its bindings refers to that entity
I'll make the one-word change in the Report that Simon suggests, though.
Simon