Module names and file names are completely independent on the language level. You can have a file `whatever.d` with `module foo.bar.totally.different;` and `import foo.bar.totally.different` and it all works as long as you add the whatever.d to the build.

The only reason people recommend they match is that then the file can be found automatically.

dmd program.d whatever.d # works from module names

dmd -i program.d # now it will look for foo/bar/totally/different.d by convention because you didn't list the file.


That one `import p;` is kinda weird, it should probably complain then you imported one thing and got another, but generally the name not matching is no problem at all.

Reply via email to