<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<style>body{font-family:-apple-system,Helvetica,Arial,sans-serif;}blockquote{margin:0;padding:0 0 0 12px;border-left:1px solid #aaa;color:#aaa;}hr.unibox-forward{border:0;color:#888;background-color:#888;height:1px;}</style>
</head>
<body>
<div>Sorry, that was a terrible example which doesn’t work (typing code into an email at this point in the afternoon isn’t a good idea it seems!)</div>
<div><br></div>
<div>I made a simple example project to show the issue. Two methods in the view controller, different behaviour depending on the trailing semicolon:</div>
<div><br></div>
<div>http://interealtime.com/misc/Semicolon.zip<br>
</div>
<div><br></div>
<div>This scenario would be ‘wrong’ in general code, but is pretty common during debugging - and that trailing semicolon is actually necessary in this case (I hit this for real yesterday).</div>
<div><br></div>
<div class="unibox-signature"><span style="color: rgb(54, 61, 76);">Chris</span></div>
<div><br></div>
<blockquote type="cite" class="unibox-hidden">
<div>On Mar 17, 2016, at 3:44 PM, Chris Wood <chris@interealtime.com> wrote:</div>
<div><br></div>
<div style="font-family: -apple-system, Helvetica, Arial, sans-serif;">Paul</div>
<div style="font-family: -apple-system, Helvetica, Arial, sans-serif;"><br></div>
<div style="font-family: -apple-system, Helvetica, Arial, sans-serif;">The semicolon is actually needed still to avoid accidental multi-line statements. E.g. these functions behave differently:</div>
<div style="font-family: -apple-system, Helvetica, Arial, sans-serif;"><br></div>
<div style="font-family: -apple-system, Helvetica, Arial, sans-serif;">func doNothing1() {</div>
<div style="font-family: -apple-system, Helvetica, Arial, sans-serif;"> break</div>
<div style="font-family: -apple-system, Helvetica, Arial, sans-serif;"> print(“This text gets printed”)</div>
<div style="font-family: -apple-system, Helvetica, Arial, sans-serif;">}</div>
<div style="font-family: -apple-system, Helvetica, Arial, sans-serif;">func doNothing2() {</div>
<div style="font-family: -apple-system, Helvetica, Arial, sans-serif;"> break;</div>
<div style="font-family: -apple-system, Helvetica, Arial, sans-serif;"> print(“This text isn’t printed”)</div>
<div style="font-family: -apple-system, Helvetica, Arial, sans-serif;">}</div>
<div style="font-family: -apple-system, Helvetica, Arial, sans-serif;"><br></div>
<div style="font-family: -apple-system, Helvetica, Arial, sans-serif;">Until odd cases like this can be avoided, I think semicolons are still (though very rarely) necessary.</div>
<div style="font-family: -apple-system, Helvetica, Arial, sans-serif;"><br></div>
<div class="unibox-signature" style="font-family: -apple-system, Helvetica, Arial, sans-serif;"><span style="color: rgb(54, 61, 76);">Chris</span></div>
<div class="unibox-signature" style="font-family: -apple-system, Helvetica, Arial, sans-serif;"><span style="color: rgb(54, 61, 76);"><br></span></div>
<div style="font-family: -apple-system, Helvetica, Arial, sans-serif;"><br></div>
<blockquote type="cite" class="" style="margin: 0px; padding: 0px 0px 0px 12px; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(170, 170, 170); color: rgb(170, 170, 170); font-family: -apple-system, Helvetica, Arial, sans-serif;">
<div>On Mar 17, 2016, at 3:25 PM, Paul Ossenbruggen <possen@gmail.com> wrote:</div>
<div><br></div>
<div style="font-family: -webkit-standard;">+1 I think that let people do whatever they want if i makes them happy when it makes the code less readable is not a good idea. I support the notion that semicolon should not be allowed at end of line. It does nothing to help readability of the code. If it does nothing, it should go. Swift code should be easy to read, and in this case clarity wins. We have to break the semicolon habit :-)<span class="Apple-converted-space"> </span>
</div>
<div style="font-family: -webkit-standard;"><br></div>
<div style="font-family: -webkit-standard;">Perhaps providing a warning fix-it which removes them from the end of all lines in the file. I suspect most cases the only reason people put it there is habit or they are converting old code from another language.</div>
<div style="font-family: -webkit-standard;"><br></div>
<div style="font-family: -webkit-standard;">- Paul</div>
</blockquote>
</blockquote>
</body>
</html>