If/guard-let-catch for conveniently accessing both Result type cases

Also, I just want to state this because I've read the word "frustration" a couple of times and I just want to be clear here. I was not frustrated with Swifts error handling at all before writing this thread, so I definitely did not write the proposal out of frustration. Instead I was happy that I found a nice working solution based on Result and this proposal was meant to improve the ergonomics a bit.

Independent of how things go forward with this proposal or typed throws in Swift, I will most probably keep my Result-based solution in my apps because it fulfills my needs the most, and I will also probably write about it, explaining it all in detail to those who are interested. I really don't feel any hatred or frustration, I'm sorry if any of my posts sounded different.

The only annoying thing that frustrates me a little bit now after writing the pitch is the fact that my idea gets rejected by some based on historical discussions about typed throws. I see that as a separate topic though, simply because I'm just trying to improve an already existing feature that already can be used as an alternative to error handling using throws. I do not know the history of how and why the Result feature was introduced, I'm just trying to use the best tools I have available the best way I can for my needs and encountered an inconvenience that I tried to solve. I am a bit surprised that this seems to raise the tempers. I did not intend to do that. And this being my first pitch, it's a bit demoralizing, too. Things like "you're fighting the language, and suffer the bad consequences of this bad decision" when I'm just using built-in Swift features in a way that I actually think is pretty smart...

3 Likes