On balance I think I prefer result types. Java's fully typed throws and Swift's
semi-typed throws are fine though. I can't see Swift supporting result types
because they already have throws.
-- Howard.
> On 6 Jul 2017, at 4:27 pm, Tim Wang wrote:
>
> Thanks
Thanks Howard, it's a good workaround.
Do you think it would be better to be part of swift language feature? I
wish swift team could consider this :)
On Thu, Jul 6, 2017 at 11:04 AM Howard Lovatt
wrote:
> You could use a result type, e.g.:
>
>
You could use a result type, e.g.:
https://github.com/antitypical/Result
Or roll your own result type.
I think the reason that Swift doesn't support what you want is because of
rethrows. When you declare a method as rethrows it can throw anything
because the closure it is re-throwing can throw