On Saturday, 4 November 2017 at 08:46:37 UTC, Jonathan M Davis
wrote:
Well, the modules need names. So, either, the compiler is going
to have to pick a name for you, or you're going to have to give
it one. In general though, D was designed with the idea that
modules would match files and packages would match directories
- and that the names on disk would match the ones in the file.
Overall, things are much simpler that way. On some level, you
can get around that by giving module names that don't match the
file names, but in general, you're just begging for trouble if
you don't make your file names and module names match (at least
some stuff is going to be looking for modules by looking at the
file system for them with the assumption that the package names
match folders and the module names match files). So, in the
long run, you'll just have fewer problems if you make your file
names and module names match.
- Jonathan M Davis
Yes. All that makes complete sense I guess.
It might also make sense, that if a source code file does not
contain a module statement, then it should not be treated as a
module, and the compiler should look to the import statements
instead of implicitly making in a module.
btw. That bug in gdc, which appear to do just that, is a nice bug
;-)