[swift-evolution] Proposal to remove semicolons

Chris Wood chris at interealtime.com
Wed Mar 16 10:25:15 CDT 2016


A word of warning on this - I’ve just hit a case where an end of line semicolon is actually critical!

If you’re debugging and need an early exit from a function, you add “return” somewhere in the middle of the code. But return can take an argument, so the compiler takes the argument from the following line which you think won’t be executed. Bad things happen, followed by swearing.

So in that particular case, you do in fact need to write:

return;

There may be other edge cases where it’s necessary to explicitly mark the end of something in the same way.

Chris Wood


> Hi,
> 
> I submitted a PR with a proposal to remove the swift end of line semicolons.
> 
> It was rejected because i didn't discuss it here. So here i'm discussing it :)
> 
> My proposal is simple: remove the semicolons in the end of lines.
> It isn't needed and makes the code ugly.
> It must be decided wether to use it or not for every project we start in the coding style.
> 
> What do you think?
> 
> João Nunes
> 
> 
> Sent from my iPhone
> 
> 
>  



More information about the swift-evolution mailing list