[swift-evolution] Disallowing unreachable code

Joe Groff jgroff at apple.com
Wed Mar 29 14:45:25 CDT 2017


> On Mar 24, 2017, at 3:54 PM, Peter Dillinger via swift-evolution <swift-evolution at swift.org> wrote:
> 
> I don't see anything directly relevant to this in the archives, and I haven't prepared a detailed proposal.  But I'm raising the general idea because I recently criticized Swift 3 for allowing unreachable code in a blog post: https://blogs.synopsys.com/software-integrity/2017/03/24/swift-programming-language-design-part-2/ (search for "unreachable code").  And I want you to have every opportunity to rectify this, even though I'm in the business of finding defects the compiler doesn't.  :)
> 
> Part of my argument is that people commonly ignore compiler warnings.  We see lots of defective code that would be (or is) caught by compiler warnings but people don't pay attention.

That's a fair concern, but unlike C compilers, where warnings vary widely among implementations and often aren't even on by default, Swift's warnings are considered as part of the language design and can't be turned off, so there's less opportunity or excuse to ignore them.

-Joe


More information about the swift-evolution mailing list