header-less C++: a good idea?
<p>Ignoring for now, if you will, that this may be solving a problem that perhaps doesn't exist. But if we somewhat believe that C++ could be more elegant and efficient (at compilation), if there were no header files.</p>

<p>An approach is two-pass compilation: in the first pass, the compiler would scan the source files and create a map of exported functions and classes. In the second pass, it would actually compile the source (and ensuring that the "external" functions/classes are indeed defined somewhere).</p>

<p>IDEs can maintain a map of exported functions etc from all source files in the project. When linking binary libraries, the compiler can embed this information in the binary files itself.</p>

<p>I see two benefits: coding is simpler (no need to switch between header and source files, changing header files does not lead to unnecessary recompilation, definition of template classes in source files); and efficient compilation (for the same reasons).</p>

<p>This is just an idle musing on my part, but does the community think it to be worthwhile idea? Are there other features of C++ that absolutely need header files?</p>

<p>PS: moderators, please mark it community wiki; I cannot seem to do it myself.   </p>
