How to let D's one module contains lots of classes.

Jack via Digitalmars-d digitalmars-d at puremagic.com
Sun Nov 9 01:59:26 PST 2014


On Sunday, 9 November 2014 at 09:17:19 UTC, AlanThinker wrote:
> I notice that lots of GUI library will create a module which 
> have the same name as the class to hold a class. such as:
> ///
> module tkd.widget.button;
> class Button
> ///
>
> If one module can have different classes in different files.
> It can change to:
> ///
> module tkd.widget;
> class Button
> ///
>
> If someone want port a C# library to D, it will helpful to keep 
> D code and C# same. then library user can port there app easily 
> to D.

I'm not sure but importing multiple stuff(not just classes) that 
you might not need instead of importing just what you need will 
increase bloat in your program.
So having a module for each class is better because it prevents 
unnecessary bloat.
Though that's what I understood from my prof.


More information about the Digitalmars-d mailing list