bearophile schrieb:
Daniel Gibson:
I sometimes find it convenient to just treat those values as integers,
Yes, I am sure in some situations it can be handy. But it's a a bit of
convenience that has a too much high price, the semantics is less clean, and
it's more bug prone. So no thanks. Keeping things tidy is more important.
Bye,
bearophile
Then there still is the consistency-issue (anon. enums are treated
differently then named enums).
Apart from that inconsistency: Yes, it wouldn't be unreasonable to just
cast the int to MyEnum or the other way round for comparison.
(or, in my example: MyEnum x; stream.read(cast(int)x); ...)
Cheers,
- Daniel