On Saturday, 13 November 2021 at 08:04:56 UTC, forkit wrote:

    int i;
    foreach(m; __traits(allMembers, mixin(__MODULE__)))
    // ...
    __traits(getLocation, mixin(m))[1]);

What you really should be doing is this:

```d
static import mod = mixin(__MODULE__);
foreach (i, name; __traits(allMembers, mod))
{
   // ...
   __traits(getLocation, __traits(getMember, mod, i));
   // ...
}
```

Otherwise you might run into name conflicts, and get location of a wrong symbol.

Also if you really want to be generic you should couple it with `__traits(getOverloads)`, like the docs for getLocation suggest.

Reply via email to