3 ms·
I don’t follow. Why would getting sum types in go be impossible? There is already a proposal for this: https://github.com/golang/go/issues/57644 https://github
by MarkMarine 2y ago
I don’t follow. Why would getting sum types in go be impossible?
There is already a proposal for this: https://github.com/golang/go/issues/57644 https://github.com/golang/go/issues/57644
The generic type params already supports a sum type like interface, it’s almost there.
So, if you could, please expound with on “why”
Is there something in the type system, something in the compiler that prevents it?
Anyway, re: not up to HN standards… I’m not sure what you’re talking about. You made it to the front page, you called out some legitimate issues, I liked reading what you had to say, I was just asking for more
- kokada 2y agoI think I recommend you reading the proposal them. I don't claim of being a specialist in Go to say if it is possible or not, but I find it highly unlikely given how the language is. The reason I think nullability is more likely than sum types is because Go tries to be a simple language (whatever the developers of the language think simple is), and nullability is simpler than sum types (both to implement and use). But again, I don't have any special insight