3 ms·
If you sequence (>>=) a series of Maybe's in Haskell you have hidden returns as well. Since we're talking about the application of "bind" you could think of th
by butterisgood 7y ago
If you sequence (>>=) a series of Maybe's in Haskell you have hidden returns as well.
Since we're talking about the application of "bind" you could think of the "invisible semicolon" in Go as the same kind of bind between "try" statements in Go, and get very similar behaviors - conceptually.
At least, that's how I think I've understood "try" to work.
(pseudocode... )
f := try(open(...))
num_bytes := try(write_some_bytes(f, ...))
I hope my function bailed out early at "f := try(open(...))" because the line "num_bytes..." literally makes no sense at all if f hasn't been even declared "f :=" vs "f =".
In the end, if I don't like it, I don't have to use it, but I still have to understand it if it's in the language and I'm reading other people's code.