C++ Logo

sg15

Advanced search

Re: Provide build systems with ways to build the std(.compat) modules

From: Ben Boeckel <ben.boeckel_at_[hidden]>
Date: Sun, 9 Jul 2023 10:49:32 -0400
On Sun, Jul 09, 2023 at 14:09:02 +0200, Mark de Wever via SG15 wrote:
> I agree this would make it easy to find the modules. My concern with
> reusing the include directory for modules is that it may lead to users
> writing code like:
>
> #include <std.cppm>
>
> Which then does not work as expected. I rather have a solution where the
> user can't do the wrong thing by accident.

The compiler is going to stop anything like this from working because
the `export module` being behind an `#include` is invalid C++. I don't
expect there to be any bad habit-forming behaviors with this location at
least (I'd prefer something like `/usr/include/c++modules` to at least
"hide" them from common `-I` usages, but getting the under-$prefix
directory agreed upon is more important).

In any case, if someone's attempt at using named modules is to write
`#include` at all, I suspect we have deeper education and/or
documentation issues at hand (SG20). And if we're really going down the
"wrong thing by accident" road, SG23 is probably a more impactful place
to start on such things in C++ land.

--Ben

Received on 2023-07-09 14:49:34