type
StatusCodes = (Success, Ongoing, Done)
Go in 2025, type StatusCodes int
const (
Success StatusCodes = iota
Ongoing
Done
)If you prefer, I can provide the same example in C, C++, D, Java, C#, Scala, Kotlin, Swift, Rust, Nim, Zig, Odin.
C# thankfully was designed by someone that appreciates type systems, maybe you should revisit it.
func f(x StatusCode) {
}
f(728347) // There's no such status. Whateverz, no compile error. f(728347) // There's no such status. Whateverz, no compile error.
a := 728347
f(a) // Compile error.