Modules

  • ODR by design

  • module name: export module MODULE-NAME;

  • export … symbols

  • import MODULE-NAME;

  • macros defined in a modules do not leak to the importer

  • macros defined before import do not leak into the imported module

  • can be

    • separated in two files (just like .h and .cpp)

      export void foo(); .mpp

      void foo() { return; }

    • or put in the same file (just like everything inline in .h)

      export void foo() { return; }

  • Module interface unit

    • Compilation gives (compiler specific) internal representation

    • Much like the venerable “precompiled headers”

    • Large speedup

    • Compiler not anymore needed for traversal

    • Can be done by any script

    • ⟶ tooling

    • ⟶ interfacing with other languages, without having to do extern "C" hacks