TLDR: See the last paragraph of this question.
I'm a Computer Science student trying to finish the text of my master thesis about creating a transpiler (case study).
Now for this master thesis, a part of my text is about comparing the languages involved. One of the languages is C++.
Now I'm trying to explain the difference in import/include semantics and the historical reason why C++ did it that way. I know how it works in C/C++, so I don't really need a technical explanation.
Researching extensively on Google and Stackoverflow I came up with several stackoverflow explanations and other references on this topic:
Why are forward declarations necessary?
What are forward declarations in C++?
Why does C++ need a separate header file?
http://en.wikipedia.org/wiki/Include_directive
http://www.cplusplus.com/forum/articles/10627/
https://softwareengineering.stackexchange.com/questions/180904/are-header-files-actually-good
http://en.wikipedia.org/wiki/One-pass_compiler
Why have header files and .cpp files in C++?
And last but not least the book "Design and Evolution of C++ (1994)" of Bjarne Stroustrup (page 34 - 35).
If I understand correctly this way of doing imports/includes came from C and came to be because of the following reasons:
Computers were not as fast so a One pass compiler was preferable. The only way this was possible is by enforcing the declaration before use idiom. This is because C and C++ are programming languages that have a context-sensitive grammar: they need the right symbols to be defined in the symbol table in order to disambiguate some of the rules. This is opposed to modern compilers: nowadays a first pass is usually done to construct the symbol table and sometimes (in case the language has a context-free grammar) the symbol table is not required in the parsing stage because there are no ambiguities to resolve.
Memory was very limited and expensive in those days. Therefore it was not feasible to store a whole symbol table in memory in most computers. That's why C let programmers forward declare the function prototypes and global variables they actually needed. Headers were created to enable developers to keep those declarations centralized so they could easily be reused across modules that required those symbols.
Header files were a useful way to abstract interface from implementation
C++ tried to establish backwards compatibility with software and softwarelibraries written in C. More importantly: they actually used to transpile to C (CFront) and then using a C Compiler to compile the code into machine code. This also enabled them to compile to a lot of different platforms right from the start, as each of those platforms already had a C compiler and C linker.
The above was an illustration of what I discovered by searching first ;) The problem is: I can't find a suitable reference to the historical reasons for this include strategy, aside from here on Stackoverflow. And I highly doubt my university will be happy with a stackoverflow link. The closest I've come is the "Design and Evolution of C++" reference, but it doesn't mention the hardware limitations being a reason for the include strategy. I think that's to be expected because the design of the feature came from C. Problem is that I didn't find any good source yet that describes this design decision in C, preferably with the hardware limitations in mind.
Can anyone point me in the good direction?
Thanks!