I don't understand betterC

evilrat evilrat666 at gmail.com
Fri Sep 1 13:45:05 UTC 2023


On Friday, 1 September 2023 at 13:17:08 UTC, confused wrote:
> On Friday, 1 September 2023 at 08:19:55 UTC, Richard (Rikki) 
> Andrew Cattermole wrote:
>> ``size_t`` is defined in ``object.d`` which is implicitly 
>> imported into all modules.
>>
>> If it cannot be found, one of three things is happening:
>>
>> 1) You have messed with some cli args related to picking 
>> druntime/phobos
>> 2) You have defined a module called object.
>> 3) You have a broken compiler install.
>
> I have in fact defined a module called ``` object ```. How is 
> that related to this error?
>

It is shadowing default implicit "import object;", here a 
demonstration

```d
// this example shows default implicit import of "object" module
// compile this example:
//   ldc2 -c test.d
// output:
//   tuple("object", "core", "main", "thisModule")

// just a random import
import core.stdc.stdio;

void main() { }

alias thisModule = __traits(parent, main);
pragma(msg,  __traits(allMembers, thisModule)); // has implicitly 
imported 'object' module
```



More information about the Digitalmars-d-learn mailing list