It's too bad that .NET enums aren't classes. This is not a problem with Java (JVM languages), although Scala got it wrong. Unfortunately, the author suggests using magic numbers when an inner enum would be better. There are other holes in the reasoning.

levelup.gitconnected.com/pleas

Follow

@VaughnVernon no doubt showing my ignorance of uptodate Java, but dotnet enums are valuable for at least being value types whereas java classes aren't?

@chrisfcarroll No, Java enums are sealed (final) types. .NET enums are type aliases over integers. Although F# supports common enums, it also supports discriminated unions, which are much more powerful. With C#, you can assign an ordinary integer to a variable of an enum type.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.