infelicity in module imports
Wed, 11 Jul 2001 04:14:59 -0700
It seems that I forgot to send this message a couple of weeks ago.
Assuming that silence meant assent, I implemented the proposal below
in the report I put out yesterday. But in this case silence meant you
been asked (an excellent way to reach consensus that I must remember
for the future).
So here's the message anyway. I don't think it's controversial, since
the outcome the cognoscenti were seeking, and no one else will care.
Well, so I hope!
| > In short, an import *always* brings the entire *qualified*=20
| > set of names into scope. Hiding and revealing applies only
| > to unqualified names. I must say that I thought GHC implemented
| > this rule; if not I should fix it.
| That's not my reading of the report, and it's not what GHC implements.
| import A (f)
| brings only f and A.f into scope.
How embarassing. Now I look at it (yet) again, the report is certainly
ambiguous about whether=20
imports A.g as well. But SimonM is right to say that the implication
is that it does *not* (contrary to my earlier message). But if it does
then the treatment of hiding and explicit-listing is inconsistent, which
There are two consistent positions
1. Every import of module A (no matter how constrained) imports=20
all of A's exports with qualified names. Import of qualified names is
unaffected by both hiding clauses and the explicit entity list
2. The explicit entity list, or hiding clause, for an import determines
entities are imported. The qualified names of all these entities are
into scope; in addition, for an unqualified import the unqualified names
brought into scope too.
Everyone who has spoken favours (2), and indeed GHC implements it.
So I propose to change the report to say that much more explicitly.
Any objections? =20