Global import of modules

ryuukk_ ryuukk.dev at gmail.com
Sat Apr 2 17:11:48 UTC 2022


On Thursday, 31 March 2022 at 08:45:45 UTC, user1234 wrote:
> 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 think it's bad because in theory that can break 3rd part 
> libraries.
> object.d is special, it's a fair exception, it's the runtime.
>
> Everything else should use imports + modules to have names 
> resolved consistently.

It wouldn't break anything, you can always import library modules 
with a scope

     import stuff = my.awesome.thing;
     stuff.do(); // do your thing




More information about the Digitalmars-d mailing list