|
|
|
|
|
by josephg
117 days ago
|
|
> You can construct sum types in C by combining structs and unions, but it is not an out of the box feature like in Go. Sum types are a first-class citizen in Go. Maybe I'm misunderstanding what you mean. Can you give me an example? How would you write a Result type in Go? (Result is defined as either Ok(val) or Err(err)) |
|
Go:
This one is closed. It perfectly satisfies being sum types. It may not satisfy your opinion of what makes for good ergonomics, but if you want to talk about ergonomics let's use ergonomic words, not type theory words.