As stated above, D modules are much more than C++ namespaces. D is a MODULAR language as well. Modules in D have constructors/destructors. Moreover, D has packages. Read more about modules and packages in D here: http://www.digitalmars.com/d/2.0/module.html .
Here is the most interesting part of what that page says:
Modules have a one-to-one
correspondence with source files. The
module name is the file name with the
path and extension stripped off.
Modules automatically provide a
namespace scope for their contents.
Modules superficially resemble
classes, but differ in that:
- There's only one instance of each module, and it is statically
allocated.
- There is no virtual table.
- Modules do not inherit, they have no super modules, etc.
- Only one module per file.
- Module symbols can be imported.
- Modules are always compiled at global scope, and are unaffected by
surrounding attributes or other modifiers.
Modules can be grouped together in
hierarchies called packages.
Modules offer several guarantees:
- The order in which modules are imported does not affect the
semantics.
- The semantics of a module are not affected by what imports it.
- If a module C imports modules A and B, any modifications to B will not
silently change code in C that is
dependent on A.