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!)
I made a simple example project to show the issue. Two methods in the view controller, different behaviour depending on the trailing semicolon: http://interealtime.com/misc/Semicolon.zip 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). Chris > On Mar 17, 2016, at 3:44 PM, Chris Wood <[email protected]> wrote: > > > Paul > > > The semicolon is actually needed still to avoid accidental multi-line > statements. E.g. these functions behave differently: > > > func doNothing1() { > break > print(“This text gets printed”) > } > func doNothing2() { > break; > print(“This text isn’t printed”) > } > > > Until odd cases like this can be avoided, I think semicolons are still > (though very rarely) necessary. > > > Chris > > > > >> On Mar 17, 2016, at 3:25 PM, Paul Ossenbruggen <[email protected]> wrote: >> >> >> +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 :-) >> >> >> 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. >> >> >> - Paul >>
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
