On December 5, 2006 Dima Sorkin wrote: > On 12/4/06, Peter Rybin wrote: > > To let me completely forget about header files and > > ordering of my declarations. > Hi. > > I think this will break the ability of compiling C++ modules > separately, > as compiler will have to see the whole code ahead. You might want to look at how some other languages handle this, like Modula 2/3, Ada ... Instead of seeing the whole code, the compiler sees some fraction of the code which is designated as the interface. In C++, we fraction off that part into a separate file and use text inclusion. In these other languages, there is a more disciplined approach whereby a module expresses a dependency on the other one, and the compiler extracts the interface fraction of the module. The nice thing is that because the data is structured in this way, you can optimize it cleanly. For instance, the compiler can take the interface fraction of a module, and compile it into a binary form. Then when that module is used during the compilation of hundreds of other modules, no lexical analysis or parsing has to take place. The compiler loads (or refers to an already loaded) binary structure. Similar things have been done for languages based on text inclusion, like the ``precompiled headers'' in Microsoft's compiler. Without the underlying structure which delimits the interfaces as objects, it doesn't work particularly well. You get problems with broken dependencies so that precompiled headers are not refreshed, etc.