C++ Modules

[)roi(]

Executive Member
Joined
Apr 15, 2005
Messages
6,282
In 2012 Doug Gregor (Apple) did a presentation focusing on Modules; or more specifically on the "On the Fundamental Brokenness of Headers", and how implementing support for modules in LLVM and Clang would overcome a lot of those issues: "Writing a Module Futuristic Version"; major stumbling points were seen as:
  • Transitioning existing header-based libraries
  • Interoperability with compilers that don’t implement modules
  • Requires tools that understand modules

Benefits of moving to modules were reasoned to be:
  • Compile/build time improvements
  • Modules are a huge potential win for C(++)
  • Fix various preprocessor problems
  • Far better tool experience
  • Design enables smooth transition path

Here's the slides and video from that talk: https://isocpp.org/blog/2012/11/modules-update-on-work-in-progress-doug-gregor

Many had thought this would't be possible; so was surprised to see the following tweets between the compiler teams at:

... from talks at CppCon:
Clang modules.jpg

Helloworld.jpg

In short; it's not only working, but Google has enabled in ~10% of its current codebase. So great news -- FYI I'll put up any videos links and slides when they become available.

Here's a related twitter poll on whether macros should be supported for modules, naturally the answer is yes; or as someone put it: "if you argue, you loose". https://twitter.com/meetingcpp/status/779359906667171840

Here's a link to the CppCon's site: http://cppcon.org


Next pie in the sky:
 
Last edited:

XennoX

Expert Member
Joined
Nov 15, 2007
Messages
2,205
This is good news. My only concern would be the lack of cross compiler compatibility, as right now this is only in clang.
 

[)roi(]

Executive Member
Joined
Apr 15, 2005
Messages
6,282
This is good news. My only concern would be the lack of cross compiler compatibility, as right now this is only in clang.
Sure; but doubtful that's a stalemate re staying competitive and relevant. Plus how many platforms aren't today covered by LLVM and Clang?
 
Top