I just stumbled upon <https://blog.ecosta.dev/en/tech/explaining-cpp20-modules>

I think that it is well explained and highly intuitive. (Perhaps I am biased 
though...) C++ modules allow for module descriptions , the description itself 
is a module. The descriptive module is initiated by writing:

  * export module -- and a name, let's say "alpha" , so we do have:
  * export module alpha;



the module can be used by importing it :

  * import alpha;



export modules can have a companion, you might guess it -- a module :

  * module alpha;



he companion will not contain the `export` qualifier, it can't export something 
by itself.

The module system (three keywords : `export, import and module` that's it all) 
aims to replace C preprocessor definitions (no #define and #include anymore in 
modules). At the toplevel, these C PP commands will still be allowed.

A basic, if not the basic idea: Modules can be precompiled and kept cached for 
instant use by the compiler. C++ modules are regarded as the biggest change in 
C++ since its inception. C++ is one of the major competitors to Nim (Nim itself 
being compiled to C or C++ ...) and in one or another way, it will have an 
impact on Nim. Perhaps Nim code will be part of a C++ environment relying on 
modules. Than, "someone" has to write the module definition part.

Modules (Module definitions) could be parametrized. This is not implemented 
actually, but since almost anything in C++ evolves into a template, this could 
happen here too. Moreover, C++ modules impose their own type system anyway, 
being a template or not.

Reply via email to