this post was submitted on 01 Sep 2023
339 points (96.2% liked)
Programming
17670 readers
262 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 !webdev@programming.dev
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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.