[swift-evolution] Proposal: Typed throws
cacoyi at gmail.com
Mon Dec 7 18:06:43 CST 2015
Isn't it better to have the choice of type safety, and perhaps have a
compiler option or linter to enforce it (if you choose).
func foo() throws; // defaults to ErrorType
Optional type safety:
func foo() throws(MyError); // note, only one type.
When it comes down to it, for me, the problem is that you can catch
anything you like, and the check for exhaustivity does not check what may
actually be thrown, resulting in excess code and compile-time errors.
On Tue, Dec 8, 2015 at 9:24 AM, Russ Bishop via swift-evolution <
swift-evolution at swift.org> wrote:
> IMHO be careful what you wish for. If the compiler enforces this then
> we're just repeating the mistakes of Java's checked exceptions. All roads
> would eventually lead to "throws ErrorType", defeating the supposed purpose.
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution