Speeding up importing Phobos files
Nick Sabalausky (Abscissa)
SeeWebsiteToContactMe at semitwist.com
Fri Jun 7 19:48:53 UTC 2019
On 6/7/19 5:47 AM, Mike Franklin wrote:
>
> Why not remove the arbitrary limitation that a module or package must be
> tied to a file or directory respectively?
We don't really have that limitation. The compiler gets the
package/module name from the `module ...;` statement (if any) at the
beginning of a *.d file. It's only when the `module` statement is absent
that the package/module name is inferred from the filepath. (There
*might* also be such a requirement when importing *but not compiling* a
given module, but I'm not sure on that.)
Beyond that, any other requirement for packages/modules to match the
filesystem is purely a convention relied upon by certain buildsystems,
like rdmd (and now, `dmd -i`), and otherwise has nothing to do with the
compiler.
TBH, I've always kinda wanted to just do away with the ability to have
modules/packages that DON'T match the filesystem. I never saw any
sensible use-cases for supporting such weird mismatches that couldn't
already be accomplished via -I (not to be confused with the new -i) or
version/static if.
HOWEVER, that said, you do bring up an interesting point I'd never
thought of: If concating a bunch of modules/packages into one file would
improve compile time, than that would certainly be a feature worth
considering.
More information about the Digitalmars-d
mailing list