You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for a in MyEnum gives incorrect results with enum with holes.
Before you say
Yeah, enums with holes are simply madness. We should deprecate them for 1.4.
they still have valid use cases for interop (a necessary evil) and all existing alternatives (const + distinct cint or holyEnum #13980 (comment)) have their own caveats, and in any case, we still need to support them for backward compatibility.
The fix is not hard, it's done by something similar (and simpler!) to the magic iterators.fields.
Example
whentrue: # D20200416T162309typeFoo=enum
f1 =-1, f2 =13, f3 =20for ai inFoo: echo ai
Current Output
f1
0 (invalid data!)
f2
f3
Expected Output
f1
f2
f3
Possible Solution
create a magic enumItems similar to iterators.fields
for a in MyEnum
gives incorrect results with enum with holes.Before you say
they still have valid use cases for interop (a necessary evil) and all existing alternatives (
const
+distinct cint
orholyEnum
#13980 (comment)) have their own caveats, and in any case, we still need to support them for backward compatibility.The fix is not hard, it's done by something similar (and simpler!) to the magic
iterators.fields
.Example
Current Output
Expected Output
Possible Solution
enumItems
similar toiterators.fields
Additional Information
The text was updated successfully, but these errors were encountered: