Grouped named import

Quirin Schroll qs.il.paperinik at gmail.com
Tue Jul 23 11:13:15 UTC 2024


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

Now that I understand what you mean, I suggest the following 
syntax:
```d
import c { sqlite3, miniz }
```

Essentially, you propose an `import` construct that creates a 
namespace. If you want a suggestion for the DIP name: _Import 
Namespaces_

Honestly, I like this.

It’s essentially equivalent to creating a module named `c` and 
`public import`ing all the symbols listed in the braces. (Maybe 
this doesn’t require a DIP, I don’t know.)


More information about the dip.ideas mailing list