digitalmars.D.bugs - [Issue 20008] New: __traits(allMembers) of packages is complete
- d-bugmail puremagic.com (45/45) Jun 26 2019 https://issues.dlang.org/show_bug.cgi?id=20008
https://issues.dlang.org/show_bug.cgi?id=20008 Issue ID: 20008 Summary: __traits(allMembers) of packages is complete nonsense Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: default_357-line yahoo.de Consider this code: https://run.dlang.io/is/ANydDv import std.meta; void main() { alias module_ = __traits(parent, main); static assert(anySatisfy!(isSame!main, allMembers!module_)); static assert(anySatisfy!(isSame!std, allMembers!module_)); pragma(msg, __traits(allMembers, std)); // static assert(anySatisfy!(isSame!(std.meta), allMembers!std)); } alias allMembers(alias Sym) = staticMap!(getMember!Sym, __traits(allMembers, Sym)); template getMember(alias Sym) { alias getMember(string ident) = __traits(getMember, Sym, ident); } template isSame(alias Sym1) { enum isSame(alias Sym2) = __traits(isSame, Sym1, Sym2); } As can be seen by the pragma(msg) and the spectacular errors when you comment in the commented-out line, the contents of __traits(allMembers, std) are not at all things that can be written in the form "std.<member>". Expected: tuple("meta") Got: tuple("object", "AliasSeq", "Alias", "OldAlias", "staticIndexOf", "genericIndexOf", "Erase", "GenericErase", "EraseAll", "GenericEraseAll", "EraseAllN", "NoDuplicates", "Replace", "GenericReplace", "ReplaceAll", "GenericReplaceAll", "Reverse", "MostDerived", "DerivedToFront", "staticMap", "allSatisfy", "anySatisfy", "Filter", "templateNot", "templateAnd", "templateOr", "aliasSeqOf", "ApplyLeft", "ApplyRight", "SmartAlias", "Repeat", "staticSort", "staticMerge", "isLessEq", "staticIsSorted", "Stride", "Instantiate", "isSame", "expectType", "expectBool", "Pack") This means it is still impossible to walk all transitive imports. --
Jun 26 2019