[Issue 14561] Large enums cannot be parsed due to too many recursive template expansions

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun May 10 07:09:17 PDT 2015


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

Simen Kjaeraas <simen.kjaras at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras at gmail.com

--- Comment #2 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
(In reply to yebblies from comment #1)
> I've hit this same issue, and considered posting about it on that pull
> request.  But I'm pretty sure the real problem here is that EnumMembers
> instantiates with the list[1..$] pattern when it has other options.

EnumMembers is one problem, and is easily solved with divide-and-conquer, as
used in staticMap, allSatisfy and a few other functions in std.typetuple.

The problem is NoDuplicates. EraseAll (called by NoDuplicates) can also be
divided and conquered, but I see no way to make NoDuplicates anything other
than O(N). It could test for the first ten elements instead of just the first
one, thus effectively increasing the max list size by a factor of 10, but then
people will come asking why we don't support enums of 5000+ elements.

--


More information about the Digitalmars-d-bugs mailing list