[swift-evolution] Disallowing unreachable code

David Sweeris davesweeris at mac.com
Wed Mar 29 01:11:42 CDT 2017


On Mar 28, 2017, at 21:55, Peter Dillinger via swift-evolution <swift-evolution at swift.org> wrote:

>>>> On Mar 28, 2017, at 9:40 PM, Peter Dillinger <Peter.Dillinger at synopsys.com> wrote:
>>>> Agreed, we have the right design here.  The go community has shown the result of taking
>>>> a hard line on this, and it really hurts refactoring and other experimental “pound out some
>>>> code” prototyping use cases.  We use warnings for things that “should be cleaned up before
>>>> code is committed”, but which is not itself a fatal issue.
>>> 
>>> Missing 'try' is a fatal issue?
>> 
>> That could be argued I suppose, I was referring to unreachable code, unused variables,
>> variables that are never mutated, etc.
> 
> And what about non-exhaustive switch?

Switches are required to be exhaustive in Swift, but code is not required to be called.

- Dave Sweeris


More information about the swift-evolution mailing list