N4047: A Module System for C++—Gabriel Dos Reis, Mark Hall, Gor Nishanov

Save to:
Instapaper Pocket Readability

A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N4047

Date: 2014-05-27

A Module System for C++

by Gabriel Dos Reis, Mark Hall, Gor Nishanov


This paper presents a design of a module system for C++. The proposal focuses on programmer’s view of modules (both production and consumption) and how to better support modular programming in the large, componentization, scalable compilation, and semantics-aware developer tools.

Add a Comment

You must sign in or register to add a comment.

Comments (1)

1 0

Arthur Langereis said on May 27, 2014 02:35 PM:

Given that this proposal does not incorporate Clang's "transitional" module map files, I was curious if the authors feel there is a place for things like the `link` command in those maps (or #pragma comment in MSVC) that can tell compilers automatically that a library / framework is necessary.

Additionally, I fear that for a long time we'll have to see stuff like:

#if __has_feature(cxx_modules)
module my_module;
import std;
#include <iostream>
#include <...> // many more #includes

#if __has_feature(cxx_modules)
export {
... export statements

//... rest of file, potentially with more #ifdefd logic.
// (not to mention the abstraction of __has_feature, which may not be availableā€¦)

So, instead of reducing/removing preprocessor directives, it will add them, cluttering up source files even more.

I'm also wondering if there should be special provisions made for `import std;` This has the effect of exposing the entire standard library, albeit inside the std namespace. For IDEs with type completion interfaces this could add a lot of noise to the search space. I guess this is more a best practices and/or a compiler problem.

And surely no module would be allowed to:

export {
module std;