Since dmd 2.096.0: import `x.t` is used as a type

kdevel kdevel at vogtner.de
Sun May 2 20:32:13 UTC 2021


On Sunday, 2 May 2021 at 18:36:25 UTC, Basile B. wrote:
[...]
> BTW during the PR review the problem you encounter [was 
> anticipated](https://github.com/dlang/dmd/pull/12178#issuecomment-773886263) si I guess you're stuck with [the author answer](https://github.com/dlang/dmd/pull/12178#issuecomment-773902749), i.e "this worked because of a special case".

Sure.

> Again you can still try to get the change turn into a 
> deprecation first, that'd be legit.

It only broke the compilation which I already have fixed. Kind 
of. I would have filed a bug if the runtime went kaput.

After reading 
https://dlang.org/spec/module.html#module_declaration again I 
wonder why there is no advice to avoid module (file) names which 
equate symbol names defined in the module. I also wonder how I 
get a module file named ``foo-bar.d`` referenced from another 
module. Following the advice in the documentation

```
// foo-bar.d
module foo_bar;

void foo ()
{
}

// main.d
import foo_bar;

void main ()
{
    foo;
}
```

it does not compile:

```
$ dmd -i main.d
main.d(1): Error: module `foo_bar` is in file 'foo_bar.d' which 
cannot be read
```


More information about the Digitalmars-d-learn mailing list