this post was submitted on 27 Feb 2024
15 points (85.7% liked)

Golang

2161 readers
8 users here now

This is a community dedicated to the go programming language.

Useful Links:

Rules:

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] canpolat@programming.dev 5 points 7 months ago

I mainly develop in C#, and I agree that having to write so much boiler plate for type safety is really boring. C# is not perfect either (it doesn't have discriminated unions, etc.) but at least it gives type safety out of the box.

However, in general, I think enums are widely misused. I see a lot of cases where they should have been classes with a factory, but ended up being enums with a lot of static functions and switch statements.