Module Clarification
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Sep 22 13:09:41 PDT 2016
On 9/22/16 10:29 AM, Jonathan Marler wrote:
> If the package.d file didn't exist, then I don't think there would be
> any problem with hierarchical modules. Is this the right conclusion?
> Was package.d a mistake? Maybe the reasoning is that D doesn't really
> like hierarchical modules, so creating them should look a bit odd?
Before package.d support, you could not do any importing of packages.
You could only import modules. package.d was how the compiler allowed
importing packages.
I don't know that there is a fundamental difference between
foo/package.d and foo.d, but this is just the solution that was chosen.
Is it a mistake? I don't think so, it's just a preference.
Prior to this, it was common to put "package" imports into an "all.d" file:
foo/all.d // import fooPart1.d fooPart2.d
foo/fooPart1.d
-Steve
More information about the Digitalmars-d-learn
mailing list