FYI: Be careful with imports when using public:

user1234 user1234 at 12.de
Wed Oct 11 12:45:15 UTC 2023


On Wednesday, 11 October 2023 at 11:34:50 UTC, Salih Dincer wrote:
> Other is "Renamed Imports", a local name for an import can be 
> given. For example:
>
> ```d
>   public:
>
>      import std.range.primitives : wl = walkLength;
> ```
>

other is to use a `from` instance alias and to fully qualify your 
accesses:

```d
module m;

alias from_prims = from!"std.range.primitives";

void v(T)(ref T t)
{
      const wl = from_prims.walkLength(t);
      ...
}
```

that way you can just ignore whether the alias is public or not.
(note: yes I know that this also implies that UFCS has to be 
sacrificed)


More information about the Digitalmars-d mailing list