|Version 1 (modified by 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
foo is ambiguous. This is sometimes tiresome: a new import can force you to add extra
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).