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

Hipreme msnmancini at hotmail.com
Fri Nov 4 16:56:59 UTC 2022


On Friday, 4 November 2022 at 16:21:17 UTC, z wrote:
> On Friday, 4 November 2022 at 10:57:12 UTC, Hipreme wrote:
>> ...
>
> What do we use instead?
> I won't lie about the fact package.d forced me to workaround 
> elusive "bugs" in my usage(1) but what is the alternative if we 
> don't want to work around it?
>
> (1)(ime : had cases of package.d requiring compiler specific 
> pragmas for LDC, and dub can't find the package's `source` 
> files at all if it's a multi file subpackage intended to be 
> imported only, i never got it working with `package.d`, only a 
> single source file setup `*packagename*.d` would work...)


You can use any name instead. The only difference between an 
ordinary source file and a package.d is the module name. For 
instance, if you're inside the filesystem directory, you can 
change the name to literally anything and import instead. To make 
my engine's names unique I have been using a convention for the 
package.d names as an abbreviation of the directory name plus 
`definitions` or something like that.


More information about the Digitalmars-d-learn mailing list