Suggestion to implement __traits(getImports, Scope)

captaindet via Digitalmars-d digitalmars-d at puremagic.com
Sat May 10 09:29:13 PDT 2014


On 2014-05-09 04:46, Mason McGill wrote:
> On Friday, 9 May 2014 at 04:09:46 UTC, captaindet wrote:
>> by coincidence, i have use for this too. also thought __traits(allMembers, ...) would work. too bad it doesn't. is this a bug or expected behavior?
>>
>> /det
>
> Just out of curiosity, what's your use case?

i create a class at compile time to ease interfacing a huge package, mostly to spare the user tons of boilerplate code. not all sub-modules are interesting. since they have to be (public) imported into the module that generates the helping class, this could switch on - in a very transparent way for the user - the generation of respective boilerplate code and exposing functionality.

obviously, i want to avoid a public import of the whole package - since only a few sub-modules will be used. currently, i have 2 different places in my helper module where functionality is switched on (for imports, and for code generation) and i don't like it.

i will experiment with mixin templates now, but i find this approach ugly and not transparent.

/det


More information about the Digitalmars-d mailing list