I have a file named "Object.d", in a directory called "foo". The module name of this file is "foo.Object". As it happens, I'm using OS X which uses a case insensitive file system. I also have another file, say "Bar.d" in "foo", with the module name "foo.Bar". When I try to compile/run Bar.d with rdmd as follows:

rdmd foo/Bar.d

I get a lot of errors like "undefined identifier string" and "undefined identifier size_t" from some modules in druntime and Phobos. If I rename "foo/Object.d" to "foo/Object2.d", leaving the module name as "foo.Object" everything works as expected.

WAT?? I thought D's module system would prevent mistakes like this. Is this the expected behavior? I think the issue is that "rdmd" adds a flag, "-Ifoo", when running dmd to get the dependencies. But the module system should still prevent it. It seems like the compiler uses the filename instead of the declared module name as the module name.

--
/Jacob Carlborg

Reply via email to