www.digitalmars.com         C & C++   DMDScript  

D - Linker optimization?

If you compile and link a bunch of D files, does the linker strip out unused
classes? Or unused modules?

The reason I ask is this: if the linker strips at the module level, it would
behoove one to place large-ish (related) classes into separate modules. If
they're reasonably small then it's often useful to place them within one
module when it makes sense from an organization and convenience standpoint.
Note that large-ish classes includes tiny ones that import a bunch of stuff
(e.g. a RegExp wrapper).

[Of course, the question should be moot if one were to place all those D
files in a library]

Ben? Walter?


(For Java folks: this is quite different from Java where one is typically
forced to separate each class at the module level, and is why 'private' is
module-scoped rather than class-scoped).
Mar 27 2004