4 ms·
I wouldn't go as far as calling a language that has nil in 2007-2009 ridiculous and I didn't do so. But adding sumtypes in 2025 and using a default nil or zero
by valenterry 2y ago
I wouldn't go as far as calling a language that has nil in 2007-2009 ridiculous and I didn't do so.
But adding sumtypes in 2025 and using a default nil or zero value/type to it, yeah that I do call ridiculous and I stand by it.
It might be a good decision even (I don't know), but it's still ridiculous by my understanding of that word.
- ncruces 2y agoLook, as I wrote: Go has zero values, and for a Go type to fully participate in the Go type system, it must have a zero value. Additionally, for it to fit the 2025 implementation of the runtime, its representation in memory must have a fixed size, with fixed locations for any pointers, and the memory representation of the zero value must be zero. The runtime can change, but for the runtime to change to accommodate new concepts, the change can't obliterate the expectations of 15 years of existing code. Given those restrictions, you can either not have sum types (which is the current state of affairs, and will be for the foreseeable future), or you can pick a zero value for your sum types. If you find having a zero value for sum types ridiculous, you're simply rejecting sum types in Go, which is fine. There is, after all, a reason the proposal wasn't accepted. Otherwise, we're all happy to accept suggestions that meet the criteria of not breaking compatibility or wreaking havoc with existing code.