[Issue 18422] String members and parameters cannot be mixed in, even during CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 13 03:11:44 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18422

--- Comment #9 from Andrei Alexandrescu <andrei at erdani.com> ---
(In reply to hsteoh from comment #8)
> It's a bit ironic, but perhaps reading this might help explain why what you
> proposed doesn't work:
> 
> https://wiki.dlang.org/User:Quickfur/Compile-time_vs._compile-time
> 
> OTOH, why not just make the module name a template parameter? That would
> sidestep the issue:
> 
> ----
> struct Module(string name)
> {
>     string[] allMembers() {
>         enum impl = __traits(allMembers, name);
>         return impl;
>     }
> }
> ----

Whoa, great article. I didn't know about it. Thanks!

--


More information about the Digitalmars-d-bugs mailing list