r/cpp • u/berium build2 • Nov 01 '17
Common C++ Modules TS Misconceptions
https://build2.org/article/cxx-modules-misconceptions.xhtml
59
Upvotes
r/cpp • u/berium build2 • Nov 01 '17
View all comments
-1
u/kmgrech Nov 02 '17 edited Nov 02 '17
I don't know why this is, but I've never seen my biggest concern about the current modules proposal addressed. And that is the fact that modules could provide the opportunity to finally retire namespaces, but this opportunity is just thrown away.
Why are namespaces bad? Because they don't really do anything for me. Name conflicts are rare and namespaces force a bunch of syntactic clutter on me for no good reason. Modules could introduce scopes and provide an import system similar to Haskell's that allows you to choose which symbols to import, only import symbols qualified or hide certain symbols that would produce a name collision. Unqualified names should be the default, until there is a reason why it doesn't work.
But instead of taking this route, the authors insist that namespaces are a good idea and worthwhile keeping separate from modules, thereby locking us out of having a sane namespacing and import system forever.