I don't see how to filter a custom version identifier from this traits code:

---
module test;

import std.traits   : isCallable;
version(all) version = my_version;

private bool onlyFuncs()
{
    bool result = true;
    foreach (member; __traits(allMembers, mixin(__MODULE__)))
    {
static if (!is(mixin(member) == module) && !(is(mixin(member)))) static if (__traits(getOverloads, mixin(__MODULE__), member, true).length == 0)
        {
pragma(msg, "`", member, "` ", "is not a type or a function");
            result = false;
            break;
        }
    }
    return result;
}
static assert(onlyFuncs(), "this script must hide globals as local static variable in a getter");

void main(){}
---

: Error: undefined identifier my_version in module test
onlineapp.d(12): Error: module test.my_version cannot be resolved
onlineapp.d(21):        called from here: onlyFuncs()
onlineapp.d(21):        while evaluating: static

Any idea ?

Reply via email to