Global import of modules

Petar Petar
Thu Mar 31 07:41:02 UTC 2022


On Thursday, 31 March 2022 at 06:47:46 UTC, ryuukk_ wrote:
> https://forum.dlang.org/post/csnqfrweyiplmuhofojw@forum.dlang.org
>
> That is a nice idea, but i think it is better if it is 
> supported by the compiler directly, so even if you don't use 
> dub, you get to use the feature
>
>
>    dmd hello.d --global-module=first.d,second.d,third.d
>
> This would allow me to do that: 
> https://github.com/dlang/druntime/pull/3790
>
> What is everyone's opinion?

I had a brief look at your PR and I think that indeed something 
like `--global-module`, or rather `--prelude` [[¹]][1] [[²]][2], 
is the right way to go. Hopefully, that would allow to remove the 
hard-coded logic concerning `object.d` from the compiler by 
simply adding `--prelude=../include/dmd/object.d` to `dmd.conf`.


[1]: https://wiki.haskell.org/Prelude
[2]: https://doc.rust-lang.org/beta/reference/names/preludes.html


More information about the Digitalmars-d mailing list