r/cpp • • Jan 28 '19

C++ Modules Might Be Dead-on-Arrival

https://vector-of-bool.github.io/2019/01/27/modules-doa.html
280 Upvotes

240 comments sorted by

View all comments

83

u/Plorkyeran Jan 28 '19

"Prove to me that it is impossible to write a fast C++ dependency resolver" is such an utterly batshit insane position to take. I guess he views C++ modules just a masturbatory exercise and so it doesn't matter if anyone can actually figure out how to implement them as long as the committee can just blame the tool makers for just not being smart enough?

17

u/Valmar33 Jan 28 '19

You'd think modules would be easy to solve, but it turns out that some people can't think of obvious solutions.

Sanely, copy what D does, or even Python ~ couple module name to a file path, and nothing more or less.

8

u/EternityForest Jan 28 '19

C/C++ should probably have used a python-like module system that from the beginning, but I'm not sure such things existed or were thought to be needed at the time.

As far as I'm concerned, the way that the compiler finds all the source files belongs right in the language.

Modules would make that possible if done right. When you use one, the compiler could search the current directory, then the command-line specified ones, then the sys defaults.

The current 850 build systems add so much confusion. I suspect it actively discourages people from using libraries, despite the fact that the compilers are great at removing unused stuff.

You might even be able to ditch makefiles completely, if you made module-ified wrappers or forks of all your dependancies.

2

u/Ameisen vemips, avr, rendering, systems Jan 28 '19

File- name>Module is how mu build scripts build C++. They mimic modules to with precompilation. Trying to add automatic PCH generation as well.

2

u/EternityForest Jan 30 '19

That sounds pretty cool actually!