What's New in Go 1.22: Cmp.or
blog.carlana.net
blog.carlana.net
And look how short this code is thanks to languages sane defaults. In Rust you would need T : Default + PartislEQ, and all that jazz
Is the problem really the lack of short-circuit evaluation, or the fact that passing arguments to the function requires evaluating all arguments first? I.e. is it even possible to write a function which wouldn't evaluate all args before calling?
The other bit was also interesting:
> According to the proposal, the built in constant `zero` would be available in generic functions for return or comparison. However, after the proposal was accepted, it was retracted due to continued community push back against the idea of having both `nil` and `zero` in the language.
So instead of having a `zero` we have many zeroes `nil`, 0, `""`, etc. Go really eschews abstractions.
One big problem with null pointers is that there's only one of them. (One of a given type doesn't help.)
Hoare's "NULL was my biggest mistake" rant proposed the wrong solution, namely no null.