Re:Go 1.18 Beta 1 is available, with generics
by lucian1900 on Wednesday December 15, 2021 @09:48AM
(#29566638)
Go switches with exhaustion checks like in [1] would go a long way. An early return construct would be important as well, though, you're right.
Go's for loops can only iterate over builtin types: slices, maps, channels, etc. You can't produce a custom type that is to be iterated over.
I disagree that it would be without sacrifice. That's kind of the whole point.
Unless I'm missing something, go has iterators with for loops.