News for hackers. Stuff that matters.
Re:Decoding JSON sum types in Go without panicking by pstuart on Wednesday March 19, 2025 @07:34PM (#43418386)
> until (if) the language gets some sort of sum type

Is there any discussion with the Go team about this actually happening?

Re:Decoding JSON sum types in Go without panicking by ajb on Wednesday March 19, 2025 @11:24PM (#43419650)
I don't know about recently, but people were asking about them from the first announcement in 2009; and got the answer that they were "under consideration"

To be fair, it's a significant advantage of go that they have been strict about keeping it's feature set small.

Edited to add:

There is this 2023 proposal from Ian Lance Taylor (on the go team) https://github.com/golang/go/issues/57644 But it makes all sum types include nil, which seems suboptimal

Re:Decoding JSON sum types in Go without panicking by pstuart on Friday March 21, 2025 @11:11PM (#43443019)
Well, he advocated for and eventually got generics, so it could happen here too.