Multiple modules per file

Paul Backus snarwin at gmail.com
Mon Jun 20 19:25:23 UTC 2022


On Monday, 20 June 2022 at 17:15:07 UTC, Steven Schveighoffer 
wrote:
> Another option is to use a different filename for such "package 
> modules", like `.dp` for "d package"?

Yeah, this could work if you restrict it to one package per file.

> Well, we already get messages because of the terrible error 
> message you get when it can't find your module file (`module 
> object is in object.d which cannot be read`). In this case, it 
> might be even worse, suggesting that it can't read your module, 
> when it's obviously in the right place.

That message has actually been improved in DMD 2.100:

```
$ cat test.d
import no_such_module;
$ dmd -c test.d
test.d(1): Error: unable to read module `no_such_module`
test.d(1):        Expected 'no_such_module.d' or 
'no_such_module/package.d' in one of the following import paths:
import path[0] = /usr/include/dmd/phobos
import path[1] = /usr/include/dmd/druntime/import
```


More information about the Digitalmars-d mailing list