3 ms·
You'd have the same effect (you don't know what specific call failed) if all of the comment lines said "return err", which is a common pattern in Go. The Scala
by pcwalton 12y ago
You'd have the same effect (you don't know what specific call failed) if all of the comment lines said "return err", which is a common pattern in Go. The Scala approach mentioned is just sugar for that. You can of course handle each case separately if you want in Scala, just as you can in Go, but the common pattern has sugar.
- frowaway001 12y agoWhat? Actually, absolutely not. If you only care about whether something succeeded use Option, if you care about the error use Either, Validation, etc. Just pick the right Monad.
- pcwalton 12y agoYes, I agree, but I don't see how that's related to what I said.
- frowaway001 12y agoThen maybe don't comment?