C++ 17 may support headerless code. Will UE4, too?

We love the idea of headerless C++ and we’re following C++17 efforts closely. However, it’s not clear that the C++17 modules proposal actually achieves headerless C++, though it’s a welcome step along the way. It’s also not clear how or whether this works “in the large”, for example in the context of a large C++ codebase that includes many classes and templates.

The language might even require syntax changes resulting on a context-free grammar for this to work, e.g. right now parsing “a<b>c;” requires knowing whether “a” is a variable or a template class, as it could be a comparison or a declaration of a variable of template type! Right now this kind of construct requires forward declarations, which would ideally go away with a Java-style module system. See http://www.csse.monash.edu.au/~damian/papers/HTML/ModestProposal.html for one set of ideas along these lines.

In our ideal world, C++ would eventually evolve to support:

  • Headerless code through modules with inline declarations.
  • Introspection and metadata, eliminating the need for UHT.
  • Open-world backwards compatibility rules closer to Java (e.g. adding a new virtual function to a class doesn’t break existing DLLs referencing that class.)

The growing consolidation of C++ tools around clang and LLVM and robust work around improving them makes this seem in reach early in the next decade.

Tim

I find that A Modest Proposal: C++ Resyntaxed, quite interesting. I would love to see something like that sooner than later. Next decade sounds scary. :smiley:

Seems there no way of not using those obj, func, type. But I think I understand why C# can live without it, and a better C++ may not be able to do so. Still an noticeable improvement though.

“I find that A Modest Proposal: C++ Resyntaxed, quite interesting. I would love to see something like that sooner than later. Next decade sounds scary. . . Still an noticeable improvement though.”
Nice!
“All good things come. . . .”
Well. You know the rest.

Fortunatly, that’s not correct. Include directives were created to speed up the compilation process, which at the time was horrendous by current standards. It’s a concept that only exists before linking, and it doesn’t affect the final binary apart from a few corner cases.

Well I stand corrected (as expected!). Interesting conversation…

C++ module support in VS2015 Update 1