2 ms·
>The author is just trying to prove that C++ modules cannot be like Java or Python modules, which apparently some people don't get. I don't think he trys that
by 1ris 9y ago
>The author is just trying to prove that C++ modules cannot be like Java or Python modules, which apparently some people don't get.
I don't think he trys that and i don't think it's true. The committee doesn't want to that, but I don't see why it would be possible by extending the language.
Introducte a module - keyword, that works pretty much like a namespace keyword. Force the file name and path to match the name a la java. Introduce a mechanism a la "using namespace" that does import the namespace (like #include header.h) of the module and tells the build system what to build. Neither needs to become the other to do this if we forbid preprocessor commands and if constexprs around that. Allow attributes to specify visibility.
Of course it's going to be a way more complicated, but i can't see how it would be impossible.
I think c++ devs just don't want that.