Grouped named import

ryuukk_ ryuukk.dev at gmail.com
Mon Jul 22 12:46:04 UTC 2024


On Monday, 22 July 2024 at 12:06:52 UTC, Quirin Schroll wrote:
> On Monday, 22 July 2024 at 11:23:51 UTC, ryuukk_ wrote:
>> Saw this somewhere, and to be honest, that's something i 
>> always wanted to be able to do
>>
>> That may be something i could try to implement, sounds 
>> relatively easy
>>
>> ```D
>> import c = sqlite3, miniz;
>> ```
>>
>>
>> https://dlang.org/spec/module.html#renamed_imports
>
> Is it equivalent to this?
> ```d
> import c = sqlite3;
> import miniz;
> ```
>
> If yes, this requires no DIP. But honestly, the reason why D 
> requires separate import statements for renaming stuff is that 
> it’s much clearer.

No, i specifically wrote grouped, there might be a better word 
for it

It means, symbols from `sqlite3` and `miniz` are isolated into 
the `c` name

Example:

```D
c.sqlite3_init();
c.miniz_init();
```

This is useful for ImportC


More information about the dip.ideas mailing list