The Hidden Complexity of Apparent Simplicity
Go attempted to “keep things simple” by not including generics and sum types in the original language design. While this might make the language appear simple, you end up introducing a lot of ad-hoc solutions to work around the lack of a more powerful type system.
For example, what happens in Go when you try to get a missing key from a map? You get a “default” value back. How do you differentiate a missing value from the default value? You check the error return code. How do you know if a pointer references an object? You check whether it’s nil
or not. What happens if you send to a nil
channel? You better not do that.
All of this could have been avoided with an Option<T>
type; suddenly the “simple” solution doesn’t look so simple any more.