module name inference

Timothee Cour thelastmammoth at gmail.com
Mon Jul 15 08:45:33 PDT 2013


currently when no module declaration is given, the module name is given by
the path base name (__FILE__.baseName.stripExtension).
This is rarely useful (as soon as one has modules nested in packages).
Why not instead infer the module name from the relative path of __FILE__
with respect to the first directory in the import list in which __FILE__ is
found:

---- src/foo/bar.d:
// infers 'module foo.bar;' instead of 'module bar;'
void barfun(){}
----

---- src/main.d:
import foo.bar;
void main(){}
----

dmd -Isrc src/main.d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130715/363cda23/attachment.html>


More information about the Digitalmars-d mailing list