this post was submitted on 01 Sep 2023
336 points (96.2% liked)
Programming
17522 readers
541 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
"Easy to learn" and "good type system" will by necessity be opposing forces IMO. If you want to work with a good type system you're gonna have to put in the effort to learn it, I'm not sure there's this magical formulation of a good type system that's also intuitive for most new developers. Hope to be proven wrong one day tho but so far no dice.
I think TypeScript has a pretty good type system, and it's not too hard to learn. Adding sum types (i.e. enums or tagged unions) to Go would be a huge improvement without making it much harder to learn. I also think that requiring nullability to be annotated (like for primitives in C#, but for everything) would be a good feature for a simple type system. (Of course that idea isn't compatible with Go for various reasons.)
I also think that even before "proper" generics were added, Go should have provided the ability to represent and interact with "a slice (or map) of some type" in some way other than just
interface{}
. This would have needed dedicated syntax, but since slice and map are the only container types and already have special syntax, I don't think it would have been that bad.The nuances of Go syntax requirements are stupid at times, but I am shocked at how much it helps readability.