DEV Community

Discussion on: Go 2 Draft: Error Handling

Collapse
 
jbristow profile image
Jon Bristow

tldr: go maintainers stubbornly refuse to admit that nil and not having union types are their two biggest mistakes.

Mistakes that are unfixable at this point.

Collapse
 
dean profile image
dean • Edited

From the Go 2017 user survey:
2017 user survey

Union/Sum types are never mentioned (although "types" is)... Honestly I think I can live fine without sum types

Error handling, dependency management, and generics are by far the most mentioned things, so those are what they are focusing on.

Collapse
 
sirkon profile image
Denis

Honestly I think I can live fine without sum types

Honestly I think you have never used them before, aren't you?

Thread Thread
 
dean profile image
dean

Uhhh nope, can't say I've ever had the desire to use them though

I know some people really adore them, and I know they can be useful, but in Go we've got interfaces and maybe even contract-based generics soon, which honestly kinda makes it so we don't really have a large need for union types 🤷‍♂️

Thread Thread
 
sirkon profile image
Denis • Edited

Uhhh nope

You doesn't talk like a coder. Real coder will answer "Nope, I used them" or "Indeed, I didn't use them". I don't understand you.

but in Go we've got interfaces

Are you sure about "uhhh nope"? Visitor pattern destroys readability (and performance for short unions replacement - and we actually need only short unions), other interface based approaches in Go don't provide type safety.

even contract-based generics soon

generics are orthogonal to to algebraic/variadic data types. They become much better with generics though and can provide full type safety for error handling (unlike current approach).

I am afraid you are actually have a little sense about the idea.

Thread Thread
 
jbristow profile image
Jon Bristow

Don't waste your time arguing. Go is designed to minimize amount of computer science needed to do work. It is NOT designed for productivity or engineer happiness. It is specifically designed to make developers easily replaceable.