News for hackers. Stuff that matters.
Re:Go is boring, and that’s fantastic by masklinn on Friday July 03, 2020 @06:03PM (#23728031)
> My understanding is that there's no real distinction between "sum type" and "union type" as such.

There’s a difference in the ambiguity — or lack thereof — which is the purported reason why go could not have sum types.

> But in Rust, as I understand it, enum variants aren't actually types.

That’s correct. They’re just constructors for values if the enum type.

> It's just too late for Go to do anything here, I think. Zero values permeate the language. For example, consider structs. It's normal to do

It’s not too late for anything. Existing types do not have to change and don’t prevent adding new non-default-able types (which would be transitive).

Those types, with those new guarantees, would not allow for the magical zeroing and zero-extending of existing types but they would not break anything.

There are no comments on this comment yet.