Why modules is so strongly limited?

Lodovico Giaretta via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 13 14:06:56 PDT 2016


On Wednesday, 13 July 2016 at 20:58:02 UTC, imbaFireFenix wrote:
> Hello my friends!
> I'm new user of D language and leaarning how it works.
> I'm know C++ and trying Rust, GO and some else and now - D is 
> the best language for me
>
> But I'm confused... Many coders was great work and interesting 
> features, but modules is so strongly limited!!!
>
> https://dlang.org/spec/module.html
> Only one module per file.
>
> but Rust and beta VC++ can multiple file to one module! Why 
> implemented this limit?
> Why modules not written as mix of C# namespace and C++ 
> translation unity? It will be greatly!
>
> But for now for huge project need to do:
>
> ~~~ ~~~ ~~~
>
> module M1;
>
> class M1
> {
> }
>
> ~~~ ~~~ ~~~
>
> module M2;
>
> import M1;
>
> public alias M1 = M1.M1;
>
> ~~~ ~~~ ~~~
>
> import M2;
>
> int main()
> {
>     M2.M1 Something;
> }
>
> ~~~ ~~~ ~~~
>
> Thanks.

You can do that with package modules:

https://dlang.org/spec/module.html#package-module


More information about the Digitalmars-d mailing list