27 ms·
> Your "simple solution" misses the point of the article which is to have the compiler automatically generating the serialized string representation of the enum
by gituliar 3y ago
> Your "simple solution" misses the point of the article which is to have the compiler automatically generating the serialized string representation of the enum without a human programmer having to manually code the switch case statements or array lookups and also avoid manually keep the enum & array in sync.
I agree, in some cases automatic generation might save you some typing.
It might be also painful to maintain, as changing a string requires to change a corresponding enum everywhere in the code.