Thread overview
[Issue 20008] __traits(allMembers) of packages is complete nonsense
Aug 25
Basile-z
Aug 25
Basile-z
August 25
https://issues.dlang.org/show_bug.cgi?id=20008

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b2.temp@gmx.com

--- Comment #1 from Basile-z <b2.temp@gmx.com> ---
One problem is that "std" as member of the module is actually "std.meta". It appears like that by accident and could lead to what I call symbol leaks. The allmembers traits actually always takes the ident of a symbol but for imports this should be a FQN.

--
August 25
https://issues.dlang.org/show_bug.cgi?id=20008

--- Comment #2 from Basile-z <b2.temp@gmx.com> ---
with the patch for the FQN in allMembers, this code

---
void allMembers(string p)()
{
    alias P = mixin(p);
    static if (is(P == module) || is(P == package))
    {
        enum members = [__traits(allMembers, P)];
        pragma(msg, p, " ", members);
        static foreach (m; members)
            static if (m != "object")
                static if (is(mixin(m) == module) || is(mixin(m) == package))
                    allMembers!(m);
    }
}

import std.algorithm;
void main(string[] args)
{
    allMembers!("std.algorithm");
}
---

outputs:
---
std.algorithm ["object", "std.algorithm.comparison", "std.algorithm.iteration",
"std.algorithm.mutation", "std.algorithm.searching", "std.algorithm.setops",
"std.algorithm.sorting", "std.functional"]
std.algorithm.comparison ["object", "std.functional", "std.range.primitives",
"std.traits", "std.meta", "std.typecons", "std.internal.attributes", "among",
"indexOfFirstOvershadowingChoiceOnLast", "castSwitch", "clamp", "cmp", "equal",
"MaxType", "EditOp", "Levenshtein", "levenshteinDistance",
"levenshteinDistanceAndPath", "max", "MinType", "min", "mismatch",
"predSwitch", "isSameLength", "AllocateGC", "isPermutation", "either"]
std.algorithm.iteration ["object", "std.functional", "std.range.primitives",
"std.traits", "std.typecons", "aggregate", "cache", "cacheBidirectional",
"_Cache", "map", "MapResult", "each", "filter", "FilterResult",
"filterBidirectional", "FilterBidiResult", "group", "Group",
"ChunkByChunkImpl", "ChunkByImplIsUnary", "ChunkByImpl", "chunkBy", "joiner",
"reduce", "ReduceSeedType", "fold", "cumulativeFold", "splitter",
"SplitterResult", "hasDifferentAutodecoding", "substitute", "sum",
"sumPairwise", "sumPairwise16", "sumPair", "sumPairwiseN", "sumKahan", "mean",
"uniq", "UniqResult", "permutations", "Permutations"]
std.algorithm.mutation ["object", "std.range.primitives", "std.traits",
"std.meta", "std.typecons", "bringToFront", "bringToFrontImpl",
"areCopyCompatibleArrays", "copy", "fill", "initializeAll", "move", "moveImpl",
"trustedMoveImpl", "moveEmplaceImpl", "moveEmplace", "moveAll",
"moveEmplaceAll", "moveAllImpl", "moveSome", "moveEmplaceSome", "moveSomeImpl",
"SwapStrategy", "isValidIntegralTuple", "remove", "removeImpl",
"removeUnstable", "removeStable", "removeStableString", "removePredUnstable",
"removePredStable", "removePredString", "reverse", "strip", "stripLeft",
"stripRight", "swap", "swapAt", "swapFront", "swapRanges", "uninitializedFill"]
std.algorithm.searching ["object", "std.functional", "std.range.primitives",
"std.traits", "std.typecons", "all", "any", "balancedParens",
"BoyerMooreFinder", "boyerMooreFinder", "commonPrefix", "count", "countUntil",
"endsWith", "hasConstEmptyMember", "RebindableOrUnqual", "extremum", "find",
"simpleMindedFind", "canFind", "findAdjacent", "findAmong", "findSkip",
"findSplit", "findSplitBefore", "findSplitAfter", "minCount", "maxCount",
"minElement", "maxElement", "minPos", "maxPos", "minIndex", "maxIndex",
"skipOver", "startsWith", "skipAll", "OpenRight", "until", "Until"]
std.algorithm.setops ["object", "std.range.primitives", "std.functional",
"std.traits", "std.meta", "std.algorithm.sorting", "std.typecons",
"cartesianProduct", "largestPartialIntersection", "std.algorithm.sorting",
"largestPartialIntersectionWeighted", "MultiwayMerge", "multiwayMerge",
"nWayUnion", "NWayUnion", "multiwayUnion", "SetDifference", "setDifference",
"SetIntersection", "setIntersection", "SetSymmetricDifference",
"setSymmetricDifference"]
std.algorithm.sorting ["object", "std.algorithm.mutation", "std.functional",
"std.range.primitives", "std.typecons", "std.meta", "std.range", "std.traits",
"SortOutput", "completeSort", "isSorted", "isStrictlyMonotonic", "ordered",
"strictlyOrdered", "partition", "pivotPartition", "isPartitioned",
"partition3", "makeIndex", "Merge", "merge", "validPredicates", "multiSort",
"multiSortPredFun", "multiSortImpl", "getPivot", "shortSort",
"trustedMoveEmplace", "sort5", "sort", "quickSortImpl", "HeapOps",
"TimSortImpl", "schwartzSort", "partialSort", "topN", "topNImpl",
"topNPartition", "p3", "p4", "topNPartitionOffMedian", "expandPartition",
"topNCopy", "topNIndex", "medianOf", "nextPermutation", "nextEvenPermutation",
"nthPermutation", "nthPermutationImpl"]
---

but apparently not all imports are handled.. for example std.typecons has not its line.

--
October 09
https://issues.dlang.org/show_bug.cgi?id=20008

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=19590

--