Working with modules

Jeremy DeHaan dehaan.jeremiah at gmail.com
Fri Feb 15 20:19:51 PST 2013


On Saturday, 16 February 2013 at 04:14:41 UTC, Ali Çehreli wrote:
> On 02/15/2013 07:50 PM, Jeremy DeHaan wrote:
>
> > I know that a module can only be defined once, but I feel
> like there
> > could be times where it would be helpful to be able to have
> the same
> > module defined in separate files
>
> There may be other ways of achieving that and I haven't given 
> much thought to your question but there is also the import 
> expression:
>
>   http://dlang.org/expression.html#ImportExpression
>
> If needed, you can include D files similar to C's #include:
>
> mixin (import ("part_of_my_module.d"));
> mixin (import ("another_part_of_my_module.d"));
>
> Ali

That is really cool! I'll look into this more, but I am using an 
IDE which would get angry if I included them in my project as .d 
files and didn't put in a module name, but I think you're on to 
something here.


More information about the Digitalmars-d-learn mailing list