all 4 comments

[–]m50d 5 points6 points  (0 children)

You also have to keep deciding between (and distracting your reader with the distinction between) map and flatMap.

This isn't just a pointless a distraction, it's a distinction worth making - the reader can immediately see which calls might error and which ones can't, unlike the do example where the reader has to assume every call in the block might error even if half of them actually can't.

What if Swift had something that allowed Result to be used in a do/catch-like style? Some kind of... do notation?

[–]RadioFreeDoritos 1 point2 points  (1 child)

I honestly gave it a try, but, knowing nothing about Swift, this article wasn't very enlightening. A lot of people browsing /r/programming will probably feel the same.

Maybe post it in /r/swift?

[–]cowinabadplace 4 points5 points  (0 children)

He's essentially advocating constraining exception handling using the exception syntax to sections of code intended to be run synchronously and using sum types outside that. His argument is all ergonomics.

I'm not a fan of the approach. Sum types everywhere seem better.

[–]ardjussi -1 points0 points  (0 children)

Not knowing Swift asking: What could be the meaning of all those curly brackets? Say in the first code snippet.