Hipreme's #4 Tip of the day - Don't use package.d

Adam D Ruppe destructionator at gmail.com
Fri Nov 4 19:53:01 UTC 2022


On Friday, 4 November 2022 at 19:40:09 UTC, H. S. Teoh wrote:
> So that you can import abc.def separately from abc.def.ghi and 
> abc.def.jkl.

This isn't that hard; in the old days you'd have `pkg.foo` then 
`import pkg.all` instead of `import pkg;`. The specific thing 
that led to the package.d thing is the desire to transition 
Phobos in addition to some flawed ideology. (One of the other 
constraints was that you should be able to zip up the directory 
of the package and have it all together, hence using 
dir/package.d instead of just dir.d. But this would have worked 
anyway if not for the inconsistent design flaw of requiring the 
file to be called package.d in the first place! And with this if 
you compile it separately vs compiling it together you get 
totally different results. It really is just a *terrible* design.)


More information about the Digitalmars-d-learn mailing list