* mlt:
Why does c++ not support packing modules into packages like in java?
I think you mean, "Why does C++ not support modules a.k.a. packages like in Java?".
Because C++ is a much earlier language. The idea of modules started AFAIK in the
late 1960's with Niklaus Wirth's Modula language (preceding his Pascal in 1971,
which didn't have modules and was more of a toy language intended for students
to be able to compile by hand, which they did, but which aspect was lost when
education went down the drain), and he built on that further when creating
Modula-2 and then Oberon. And the idea was incorporated in more practical
variants of Pascal such as UCSD Pascal, there called "units", and in Ada, there
called "packages". Then in Eiffel the ideas of class and module were merged.
Original Java, in spite of what even its designers claim, was essentially a
minimalistic stripped down Eiffel re-expressed with more familiar-to-most C-like
syntax, but in a way just as ironic as the devolution to primitive C syntax the
clean module concept in Eiffel was devolved backwards to the earlier more
primitive package concept. I think Java's popularity and Eiffel's niche status
speaks volumes about how important familiarity is. Eiffel is without a doubt the
more powerful and more clean language, but at this point it's not a practical
choice over Java since Java now has an enormous, very rich "standard" library.
C++ inherited the C separate compilation and header file way of "manually"
creating logical modules, and so the need for language supported modules in C++
wasn't pressing at that time, around 1980 -- but now it is. And it's not a
small problem. For example, a fully general module facility should allow for
separate compilation of templates, but C++ already has a language feature for
that, namely "export" that only 1 compiler implements, that stands in the way.
Its way
more easy to work with large scale applications in this way. Would that be
possible in the future with c++?
David Vandevoorde made a modules proposal but it came too late for C++0x.
It will however most probably be considered, possibly amended, and adopted, later.
Cheers & hth.,
- Alf