Dividing D Module between multiple files

rumbu via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Feb 18 12:42:31 PST 2015


On Wednesday, 18 February 2015 at 07:34:13 UTC, Daniel Kozák 
wrote:
>
> On Wed, 18 Feb 2015 07:23:24 +0000
> Muahmmad Adel via Digitalmars-d-learn
> <digitalmars-d-learn at puremagic.com> wrote:
>
>> I have searched online and I found no way for dividing D 
>> Module between multiple files.

>
> You are not force to do so I do not see any trouble here.
>
> For eg. I have lots of file where I have only one class 
> (similar to
> java concept).

The problem with this approach is that you will end with ugly 
class names like mypackage.myclass.MyClass.

I'm porting some C# code where I need the type name at runtime 
and I ended with a huge package.d file just to keep pretty names 
like mypackage.MyClass.

Another way to trick the compiler is to mixin import all modules 
in the package.d file but you'll loose features like code 
completion in your editor.


More information about the Digitalmars-d-learn mailing list