How to break module into multiple file.

Alexander aldem+dmars at nk7.net
Thu May 12 10:44:02 PDT 2011


On 12.05.2011 17:05, Jonathan M Davis wrote:

> A module is always one file and only one file.

  ...which could be really, really big due to this limitation (std.datetime), and this is not always convenient sometimes - that's why I like the idea of namespaces and partial classes.

  There is another inconvenience with D modules - compiler will *always* split module name into file system path when searching, so I couldn't have different namespaces (on different levels) in single directory, and this also forces me to match file
name with module name.

  Sure, somehow this is good - but not always, as it makes splitting of one logical module into several physical pieces quite hard. The idea of enforcing specific style of code grouping and organization is not quite good, IMHO.

  However, there is a nice trick using mixin(import("file-to-include")) - which could really help sometimes :)

/Alexander


More information about the Digitalmars-d-learn mailing list