News for hackers. Stuff that matters.
Re:Go: What We Got Right, What We Got Wrong by orangeboats on Friday January 05, 2024 @04:34AM (#38877269)
I don't see how they are fine, when NULL is widely known (even though it might not be agreed by some) as the billion-dollar mistake.

One could have easily added an Optional type that forces programmers to check for nil every time the optional variable is accessed.

Re:Go: What We Got Right, What We Got Wrong by campbel on Friday January 05, 2024 @01:58PM (#38883107)
Couldn't we do an optional type with the type system as is rather than embedding in the language?

type Optional[V any] struct { IsSet bool Value V }

Re:Go: What We Got Right, What We Got Wrong by kaba0 on Friday January 05, 2024 @04:09PM (#38884979)
The type system would store it at compile time, while your type would only have it at runtime.
Re:Go: What We Got Right, What We Got Wrong by ncruces on Friday January 05, 2024 @04:48PM (#38885426)
How does that prevent an unset Value from being used?