Building C++ modules

Atila Neves atila.neves at gmail.com
Fri Aug 9 08:37:25 UTC 2019


On Thursday, 8 August 2019 at 10:10:30 UTC, Russel Winder wrote:
> On Wed, 2019-08-07 at 16:04 +0000, Antonio Corbi via 
> Digitalmars-d wrote:
>> Hi!
>> 
>> Jussi Pakkanen (from Meson build system fame) has written this 
>> article[1] about compiling C++ code that uses modules. I think 
>> it's worth a read.
>> 
>> Antonio
>> 
>> [1] 
>> https://nibblestew.blogspot.com/2019/08/building-c-modules-take-n1.html
>
> So if C++ has this dependency problem why doesn't D, Go, or 
> Rust?

I think that one of the reasons is that D, Go, and Rust (and 
Java, and...) map module names to file names, so other than -I 
flags or equivalent there's no need to figure out where the 
modules are actually located.

C++, to preserve support for platforms that don't have a 
hierarchical filesystem (I have no idea what they are or why 
anyone cares about them), decided to punt on how to find modules 
and leaves it up to the implementation.

The other difference is that despite having modules, C++20 still 
has the equivalent of module headers and module implementations.

I read a whole blog post explaining C++ modules once. I shook my 
head throughout and can't believe what they've gone with. I've 
also forgotten most of it, probably due to my brain protecting 
itself lest I go mad.


> If one of D's plus points is fast parsing and compilation, 
> perhaps whole source at once compilation should be a good thing?

I don't think it is. Fast is relative, and it's death by a 
thousand cuts for me at the moment. And this despite the fact 
that I use reggae as much as I can, which means I wait less than 
most other D programmers on average to get a compiled binary!




More information about the Digitalmars-d mailing list