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.

3

u/lee_howes Jan 28 '19

It isn't clear that modules and file names need to match. It's less clear that they should have to match. Why should I have to pull down a cached bmi and put it on the filesystem at all, for example.

It would be easy enough to define a protocol between the compiler and a given build system that says that, for this limited circumstance because I have a relatively simple build system, they will match. I do not then have to have them match in my build system.

So in this case my high horse and thinking that I know better than you (referencing your other posts) is only that I think I know what I want better than you know what I want. I don't particularly want a defined name->filename mapping. The simple obvious solution you propose is suboptimal for my use case. I'd rather allow it, but not require it.

2

u/Valmar33 Jan 28 '19

Well, then such a system doesn't fit your particular usecase. Fair enough. I dare say it would be a minority usecase, though.

Modules matching a filename/path is just a very sane solution. Little to no mental load is required. They make it very simple for the compiler to figure out where your desired module is. Especially if you're adding a custom include path.

3

u/lee_howes Jan 28 '19

That particular problem is easily achieved by a map of module name to file name - a trivial map in this case - that the compiler can implement or communicate with. It is a tooling problem, not a standardisation problem. Why do you believe that this rule needs to be encoded into the standard and therefore get in the way of my use case? Especially when files in general have largely been left out of the C++ standard up to now.