Closed
Description
Converting an integer to enum is fraught with issues - often the integer is coming from an untrusted source such as a file or the network and in code reviews, we've found many instances where it leads to remote exploits crashing the application or worse.
The safe way to convert an enum is to use a case
statement, converting each enum value to an integer and making a comparison - a macro can be used to generate this list (see https://forum.nim-lang.org/t/8188).
The most reasonable thing for most code out there is to avoid the MyEnum(anInteger)
conversion entirely - since it can't be changed to behave safely, a compile-time warning is appropriate, educating users about the issues with the construct.