On Saturday, 1 November 2014 at 14:40:16 UTC, Dicebot wrote:
On Saturday, 1 November 2014 at 14:03:51 UTC, Nicolas Sicard wrote:
What's the reason why the module keyword was introduced in the first place? The package and module hierarchy could have been deduced from the directory and file hierarchy, as it is the case in Python, IIRC. The search rules just have to be clear. I know this has the side effect that module names can't be keywords or non-identifiers, but who would use such module names?

You can omit module declarations and those will be deduced indeed. However that will make package path dependent on compiler currend directory and this is why specifying qualified path explicitly is helpful.

Compiling is already dependent on the current directory. And qualified path are not just helpful, they're required for packages, or did I miss something?

I was thinking about the way Python does it:
- 'dmd foo.d' => 'import foo;' (if foo.d is in cwd)
- 'dmd mylib/internal/foo.d' => 'import mylib.internal.foo;' (if the path exists in the cwd) - 'dmd foo.d' and there is no foo.d in the cwd: use the search path from the config, or fail.

I see no reason to put module declarations in single level projects with no packages.

Yes, I don't put them!

Reply via email to