|Version 1 (modified by simonpj@…, 8 years ago) (diff)|
Suppose we have
module M where import Data.List nub x = x foo y = nub y
The program is rejected because the occurrence of nub in foo is ambiguous. This is sometimes tiresome: a new import can force you to add extra M.nub qualifiers.
An obvious alternative is that local declarations shadow imports, so an unqualified name means the locally-defined one. (A warning flag could tell you if you were using this ability.) This is entirely consistent with shadowing in expressions — except that you can still access at the imported thing with a qualified name.
It's not a big thing, but unless I've missed something, it seems to me that this would make the language more consistent (by treating shadowing consistently), more convenient; and of course it's completely backward compatible.
Local declarations shadow imports.
This is a modest change. But it is a change, so only worth making if there is significant support (rather than merely absence of opposition).