March 08, 2013
On 3/7/13, Robert <jfanatiker@gmx.at> wrote:
> Hi guys!
>
> I just made the discovery that putting a D source file named "d" in a
> directory named "a.b.c" with a module declaration like:
>  module a.b.c.d; works as expected

This only works if you explicitly provide the module to DMD. If you only pass the -I import switch to find the module it will not compile.

I wouldn't call this a feature, but rather a bug. It's probably a case of a string compare returning true instead of actually verifying where the module is. At best this could be a feature enhancement, but I don't think it will fly.

There is also an opposite bug: http://d.puremagic.com/issues/show_bug.cgi?id=9194
March 08, 2013
> This only works if you explicitly provide the module to DMD. If you only pass the -I import switch to find the module it will not compile.
> 
> I wouldn't call this a feature, but rather a bug. It's probably a case of a string compare returning true instead of actually verifying where the module is. At best this could be a feature enhancement, but I don't think it will fly.
> 
> There is also an opposite bug: http://d.puremagic.com/issues/show_bug.cgi?id=9194

You are right, this is sad :-( Thanks.

I think it would actually be pretty neat to support this properly, because there are times where you end up having a directory containing a single directory containing a single directory, ... just because of the module path. Having to traverse three folders just to get to the source code could easily be avoided if this was actually an official feature.

I filed a bug report:
  http://d.puremagic.com/issues/show_bug.cgi?id=9664


If you have some argument why this would be a bad idea, feel free to add a comment.

Best regards,

Robert