All members of a package.d module using string lookup.

Nils Lankila NilsLankila at gmx.us
Thu Aug 27 00:15:17 UTC 2020


On Wednesday, 26 August 2020 at 22:25:18 UTC, Ethan wrote:
> I've got some weird juju during a DMD upgrade. The code I've 
> posted below is representative of code that used to work for me 
> to scrape for objects to bind with Binderoo when using 
> package.d to make a folder a module. It has been working for a 
> while. Now it doesn't.
>
> And, weirdly, testing on godbolt with every compiler supported 
> shows *it never should have worked*.
>
> So. Using nothing but a module name as a string, what's the 
> correct way to get all members when that module is a package.d 
> implementation?

For now this is not possible because there was a bug with 
packages and `__traits(allMembers)`. You're lucky because it's 
been fixed two days ago,  see [1], but that still has to find its 
path to the stable branch.

By the way if Bindero relies on `__traits(allMembers)` on whole 
modules, I advice you to test this PR, as it may break you code.

[1] https://github.com/dlang/dmd/pull/11619
[2] https://github.com/dlang/dmd/pull/11627


More information about the Digitalmars-d mailing list