Scope of enum

DLearner bmqazwsx123 at gmail.com
Sun Jul 11 13:21:35 UTC 2021


On Sunday, 11 July 2021 at 12:47:48 UTC, Adam D Ruppe wrote:
> On Sunday, 11 July 2021 at 12:37:20 UTC, DLearner wrote:
>> C:\Users\SoftDev\Documents\BDM\D\Examples\CTFE\T2>type k_mod.d
>> // k_mod.d
>>
>>
>> ubyte[MemSiz]  MemPool;
>
> You didn't import the other module here.
>
>
> D's imports aren't like C's includes. Each module is 
> independent and can only see what it itself imports.
>
> A module has no idea who is importing it. It only knows what it 
> imports inside itself.

Adding the second import worked - thank you.

But there is a point of principle:
To me, doesn't really matter about what goes in `test01.d`, just 
test harness.

But adding `import test01.d` to `k_mod.d` looks like 'mixing' the 
real code in `k_mod.d` with other code that is just for the 
support of the test harness.
And that support would have to be changed for each test.
Surely we want the target code, if possible, to be unchanged from 
test to test?

Is there a 'D' way of avoiding the issue?




More information about the Digitalmars-d-learn mailing list