|
|
|
|
|
by mseepgood
4431 days ago
|
|
> Then there is Go's woeful head-in-the-sand type system and its dumb approach to error handling. Errors values are logical ORs -- you can return a useful value OR an error. Not necessarily. Maybe you want to return the number of bytes read until the error AND the error. > We've know how to do error handling without exceptions and without boiler plate since about 1991 (Wadler; monads). Generics since about 1985 (ML). Can we move on yet? Is a quarter-century long enough? You're conflating "it was once invented" with "it's a good thing without any trade-offs and should be put in every programming language". |
|
Not mutually exclusive. The number of bytes read until the error occurred could be part of the error itself. Sum types are practically always better. The problem is that Go does not support them.