[Issue 11451] import statements don't work when compiling several files at once
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Nov 7 05:08:11 PST 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11451
--- Comment #8 from Dicebot <public at dicebot.lv> 2013-11-07 05:08:09 PST ---
(In reply to comment #7)
> So when is the module's fully qualified name ever used in
> the absence of a module declaration?
Never. It is only used when provided explicitly.
> The way I still read it is if the module declaration is not present, then
> ModuleName is the filename without the path or extension, but
> ModuleFullyQualifiedName would depend on where compilation takes place.
I guess you may assume that `import` statement and module name are synchronized
in some way. This is not true. This is how import happens:
1) `import` statement gets directly converted into relative file path (dots
replaced with "/" and ".d" extension added)
2) If file with such relative path exists when searching from one of `-I`
paths, its module name is checked.
3) If `module` statement is present in file, it is used as module name.
Otherwise it is _always_ unqualified file name stripped from extension.
4) If module name does not match name in import statement, compilation error
happens. Comparison is fully qualified, so "src.mymod" != "mymod".
Your quoted text is not a language spec, it is just a grammar definition which
simply describes what statements are allowed to include qualified module name
(== "stuff with dots"). It says nothing about semantics.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list