3 ms·
Thank you, this is an important distinction and informs the different structural idioms of handling these cases: In Go you get a flat recipe of instructions. Y
by dgb23 6y ago
Thank you, this is an important distinction and informs the different structural idioms of handling these cases:
In Go you get a flat recipe of instructions. You find an error then exit the function somehow, usually via returning. In the subsequent blocks the soundness is sometimes only implied AKA you 'know' you handled that error before and now you can assume that the other part of your 'product type' has a certain shape but they are inherently separated types.
In Rust you get matching and function expressions (often from traits) flowing through a tree. There is a type soundness to this: Each branch in isolation is a statically checked part of the whole tree.
(I have personally never used an advanced IDE for Go, but I can at least imagine that a sufficiently powerful one can catch quite a few of these cases as well.)