More on Proposal #2717: Add nubWith, nubOrd

Yitzchak Gale gale at sefer.org
Tue Dec 2 07:01:47 EST 2008


I wrote:
>> Could you please call it IntSet.nubOrd instead?

Neil Mitchell wrote:
> I considered raising this, but decided nubInt is better than nubOrd.
> These functions don't really belong in Set/IntSet - its just a case of
> dependencies etc. As such, I don't think the usual rules apply,
> because nubOrd doesn't work on Set's at all. From a usage point of
> view, nubInt/nubOrd is much clearer.

Usually the difference between using the Map or IntMap version
of nub won't be that significant. If you are worried about the distinction
being clear, you can always use qualified imports, so that you'll
write Map.nubOrd vs. IntMap.nubOrd. It has become standard style
to give two functions the same name if they live in different modules
and they do the "same thing" except at different types.

In general I think it is worthwhile to emphasize simplicity and
consistency in namespace choices. In the case of Map and IntMap,
I would like to see us strive for the two modules to export *exactly*
the same set of symbols, except for the type names/constructors Map
and IntMap.

Thanks,
Yitz


More information about the Libraries mailing list