Proposal to remove semicolons


(Colin Cornaby) #1

It does seem odd there is a large focus on removing C style language features from Swift, but that the semi colon is still around.

I'd be in favor of making them invalid syntax on single statement lines. It reduces confusion/code style arguments. I've stopped using them in Swift. They don't do anything on single statement lines, why bother?

I'm also game for making them invalid syntax.

The only time I've seen `;` in my code is from my old Obj-C habit.

Semicolons are already optional at the end of lines and only required to separate multiple statements on the same line (and for C for loops, but changing the grammar of those or removing them is a different topic.

If your proposal is to make a semicolon at the end of a single line invalid syntax, that's fine with me, although it seems like an unnecessarily small change to the grammar (and something better handled by a linter). If your proposal is to remove the semicolon as a way to separate multiple statements on the single line, then -1.

Austin

···

On Dec 14, 2015, at 10:04 AM, Arthur Ariel Sabintsev via swift-evolution <swift-evolution@swift.org> wrote:
On Mon, Dec 14, 2015 at 12:25 PM Austin Zheng via swift-evolution <swift-evolution@swift.org> wrote:

On Dec 13, 2015, at 6:12 AM, João Nunes via swift-evolution <swift-evolution@swift.org> wrote:

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 :slight_smile:

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
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution
--
Best,

Arthur / Sabintsev.com

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(Chris Lattner) #2

There are two different topics here, and I’d suggest exploring them separately.

- The semicolon within a line is a expressivity feature.
- The semicolon at the end of the line is accepted, but generally ignored.

Most people seem to be focusing on the second one. IMO, I think that it adds value to the language for people coming from semi-colon oriented languages or bouncing between multiple languages (that muscle memory takes awhile to break). OTOH, it is just syntactic noise (along with redundant parens in conditions and many other things), and so having a warning (probably opt-in) for it would make sense to me.

-Chris

···

On Dec 14, 2015, at 10:55 AM, Colin Cornaby via swift-evolution <swift-evolution@swift.org> wrote:

It does seem odd there is a large focus on removing C style language features from Swift, but that the semi colon is still around.

I'd be in favor of making them invalid syntax on single statement lines. It reduces confusion/code style arguments. I've stopped using them in Swift. They don't do anything on single statement lines, why bother?

On Dec 14, 2015, at 10:04 AM, Arthur Ariel Sabintsev via swift-evolution <swift-evolution@swift.org> wrote:

I'm also game for making them invalid syntax.

The only time I've seen `;` in my code is from my old Obj-C habit.

On Mon, Dec 14, 2015 at 12:25 PM Austin Zheng via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:
Semicolons are already optional at the end of lines and only required to separate multiple statements on the same line (and for C for loops, but changing the grammar of those or removing them is a different topic.

If your proposal is to make a semicolon at the end of a single line invalid syntax, that's fine with me, although it seems like an unnecessarily small change to the grammar (and something better handled by a linter). If your proposal is to remove the semicolon as a way to separate multiple statements on the single line, then -1.

Austin

> On Dec 13, 2015, at 6:12 AM, João Nunes via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:
>
> 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
> _______________________________________________
> swift-evolution mailing list
> swift-evolution@swift.org <mailto:swift-evolution@swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution
--
Best,

Arthur / Sabintsev.com <http://sabintsev.com/>
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(Douglas Gregor) #3

This seems firmly in linter/style warning territory. Unlike with other features that are being removed in Swift 3.0, optional semicolons at the end of are utterly harmless: nobody is going to have to reason about them beyond “oh, I can ignore that.

  - Doug

···

On Dec 14, 2015, at 11:01 AM, Chris Lattner via swift-evolution <swift-evolution@swift.org> wrote:

There are two different topics here, and I’d suggest exploring them separately.

- The semicolon within a line is a expressivity feature.
- The semicolon at the end of the line is accepted, but generally ignored.

Most people seem to be focusing on the second one. IMO, I think that it adds value to the language for people coming from semi-colon oriented languages or bouncing between multiple languages (that muscle memory takes awhile to break). OTOH, it is just syntactic noise (along with redundant parens in conditions and many other things), and so having a warning (probably opt-in) for it would make sense to me.


(Chris Lattner) #4

I agree. I am missing the motivation for what harm they are causing.

-Chris

···

On Dec 14, 2015, at 3:44 PM, Douglas Gregor <dgregor@apple.com> wrote:

On Dec 14, 2015, at 11:01 AM, Chris Lattner via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

There are two different topics here, and I’d suggest exploring them separately.

- The semicolon within a line is a expressivity feature.
- The semicolon at the end of the line is accepted, but generally ignored.

Most people seem to be focusing on the second one. IMO, I think that it adds value to the language for people coming from semi-colon oriented languages or bouncing between multiple languages (that muscle memory takes awhile to break). OTOH, it is just syntactic noise (along with redundant parens in conditions and many other things), and so having a warning (probably opt-in) for it would make sense to me.

This seems firmly in linter/style warning territory. Unlike with other features that are being removed in Swift 3.0, optional semicolons at the end of are utterly harmless: nobody is going to have to reason about them beyond “oh, I can ignore that.


(Joao Nunes) #5

For the one asking the pr link: https://github.com/apple/swift-evolution/pull/57

The semicolon in C style loops will soon be removed. So no point in defending it. Also it was out of the scope of this proposal.

In my opinion having an optional line termination just adds confusion for new comers. And adds near 0 value to the language .
Similar to the c style loop and the ++ and -- operators, it is just old carried over stuff.
My point is, swift is a modern language, semicolons aren't . The minimal advantage of it can be easily counter-argumented. It is a natural evolutionary step to remove the semicolon in the end of the lines.

Joao

···

Sent from my iPhone

On 14 Dec 2015, at 20:01, Chris Lattner <clattner@apple.com> wrote:

There are two different topics here, and I’d suggest exploring them separately.

- The semicolon within a line is a expressivity feature.
- The semicolon at the end of the line is accepted, but generally ignored.

Most people seem to be focusing on the second one. IMO, I think that it adds value to the language for people coming from semi-colon oriented languages or bouncing between multiple languages (that muscle memory takes awhile to break). OTOH, it is just syntactic noise (along with redundant parens in conditions and many other things), and so having a warning (probably opt-in) for it would make sense to me.

-Chris

On Dec 14, 2015, at 10:55 AM, Colin Cornaby via swift-evolution <swift-evolution@swift.org> wrote:

It does seem odd there is a large focus on removing C style language features from Swift, but that the semi colon is still around.

I'd be in favor of making them invalid syntax on single statement lines. It reduces confusion/code style arguments. I've stopped using them in Swift. They don't do anything on single statement lines, why bother?

On Dec 14, 2015, at 10:04 AM, Arthur Ariel Sabintsev via swift-evolution <swift-evolution@swift.org> wrote:

I'm also game for making them invalid syntax.

The only time I've seen `;` in my code is from my old Obj-C habit.

On Mon, Dec 14, 2015 at 12:25 PM Austin Zheng via swift-evolution <swift-evolution@swift.org> wrote:
Semicolons are already optional at the end of lines and only required to separate multiple statements on the same line (and for C for loops, but changing the grammar of those or removing them is a different topic.

If your proposal is to make a semicolon at the end of a single line invalid syntax, that's fine with me, although it seems like an unnecessarily small change to the grammar (and something better handled by a linter). If your proposal is to remove the semicolon as a way to separate multiple statements on the single line, then -1.

Austin

> On Dec 13, 2015, at 6:12 AM, João Nunes via swift-evolution <swift-evolution@swift.org> wrote:
>
> 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 :slight_smile:
>
> 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
> _______________________________________________
> swift-evolution mailing list
> swift-evolution@swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

--
Best,

Arthur / Sabintsev.com

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(Joao Nunes) #6

In that case why did you accept to remove for loop c style and ++/-- operators? It is the same reasoning.

Joao

···

Sent from my iPhone

On 15 Dec 2015, at 06:56, Chris Lattner <clattner@apple.com> wrote:

On Dec 14, 2015, at 3:44 PM, Douglas Gregor <dgregor@apple.com> wrote:

On Dec 14, 2015, at 11:01 AM, Chris Lattner via swift-evolution <swift-evolution@swift.org> wrote:

There are two different topics here, and I’d suggest exploring them separately.

- The semicolon within a line is a expressivity feature.
- The semicolon at the end of the line is accepted, but generally ignored.

Most people seem to be focusing on the second one. IMO, I think that it adds value to the language for people coming from semi-colon oriented languages or bouncing between multiple languages (that muscle memory takes awhile to break). OTOH, it is just syntactic noise (along with redundant parens in conditions and many other things), and so having a warning (probably opt-in) for it would make sense to me.

This seems firmly in linter/style warning territory. Unlike with other features that are being removed in Swift 3.0, optional semicolons at the end of are utterly harmless: nobody is going to have to reason about them beyond “oh, I can ignore that.

I agree. I am missing the motivation for what harm they are causing.

-Chris


(Mosab Elagha) #7

In that case why did you accept to remove for loop c style and ++/--

operators? It is the same reasoning.

Although I wish ++/-- were still with us, those are arbitrary indicators
for += 1, so removing them would make code more clear in its intention.

Having a semicolon at the end of a line in Swift does not make any
difference in code clarity - in fact I know many who prefer to put the
semicolon, as they would like a surefire way to see the end of a
statement/line of code when working or reviewing code. It's purely a matter
of preference and removing it would give no benefit.

-1
-Mosab Elagha

···

On Tue, Dec 15, 2015 at 2:11 AM, João Nunes <swift-evolution@swift.org> wrote:

In that case why did you accept to remove for loop c style and ++/--
operators? It is the same reasoning.

Joao

Sent from my iPhone

On 15 Dec 2015, at 06:56, Chris Lattner <clattner@apple.com> wrote:

On Dec 14, 2015, at 3:44 PM, Douglas Gregor <dgregor@apple.com> wrote:

On Dec 14, 2015, at 11:01 AM, Chris Lattner via swift-evolution < > swift-evolution@swift.org> wrote:

There are two different topics here, and I’d suggest exploring them
separately.

- The semicolon within a line is a expressivity feature.
- The semicolon at the end of the line is accepted, but generally ignored.

Most people seem to be focusing on the second one. IMO, I think that it
adds value to the language for people coming from semi-colon oriented
languages or bouncing between multiple languages (that muscle memory takes
awhile to break). OTOH, it is just syntactic noise (along with redundant
parens in conditions and many other things), and so having a warning
(probably opt-in) for it would make sense to me.

This seems firmly in linter/style warning territory. Unlike with other
features that are being removed in Swift 3.0, optional semicolons at the
end of are utterly harmless: nobody is going to have to reason about them
beyond “oh, I can ignore that.

I agree. I am missing the motivation for what harm they are causing.

-Chris

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(Colin Cornaby) #8

Yeah, that’s kind of where I’m at too. Both those things are handy for long term C developer muscle memory as well, and don’t really hurt things. I don’t have extremely strong feelings on this, but if what the Swift team is going for is a dropping of C holdovers, this seems like a candidate too.

···

On Dec 15, 2015, at 12:11 AM, João Nunes <joao3001@hotmail.com> wrote:

In that case why did you accept to remove for loop c style and ++/-- operators? It is the same reasoning.

Joao

Sent from my iPhone

On 15 Dec 2015, at 06:56, Chris Lattner <clattner@apple.com <mailto:clattner@apple.com>> wrote:

On Dec 14, 2015, at 3:44 PM, Douglas Gregor <dgregor@apple.com <mailto:dgregor@apple.com>> wrote:

On Dec 14, 2015, at 11:01 AM, Chris Lattner via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

There are two different topics here, and I’d suggest exploring them separately.

- The semicolon within a line is a expressivity feature.
- The semicolon at the end of the line is accepted, but generally ignored.

Most people seem to be focusing on the second one. IMO, I think that it adds value to the language for people coming from semi-colon oriented languages or bouncing between multiple languages (that muscle memory takes awhile to break). OTOH, it is just syntactic noise (along with redundant parens in conditions and many other things), and so having a warning (probably opt-in) for it would make sense to me.

This seems firmly in linter/style warning territory. Unlike with other features that are being removed in Swift 3.0, optional semicolons at the end of are utterly harmless: nobody is going to have to reason about them beyond “oh, I can ignore that.

I agree. I am missing the motivation for what harm they are causing.

-Chris


(Chris Lattner) #9

In that case why did you accept to remove for loop c style and ++/-- operators? It is the same reasoning.

The rationale for removing them is outlined here:

AFAICT, none of the disadvantages there apply to semicolons, except perhaps the first one (which I’d consider a stretch).

-Chris

···

On Dec 15, 2015, at 12:11 AM, João Nunes <joao3001@hotmail.com> wrote:

Joao

Sent from my iPhone

On 15 Dec 2015, at 06:56, Chris Lattner <clattner@apple.com <mailto:clattner@apple.com>> wrote:

On Dec 14, 2015, at 3:44 PM, Douglas Gregor <dgregor@apple.com <mailto:dgregor@apple.com>> wrote:

On Dec 14, 2015, at 11:01 AM, Chris Lattner via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

There are two different topics here, and I’d suggest exploring them separately.

- The semicolon within a line is a expressivity feature.
- The semicolon at the end of the line is accepted, but generally ignored.

Most people seem to be focusing on the second one. IMO, I think that it adds value to the language for people coming from semi-colon oriented languages or bouncing between multiple languages (that muscle memory takes awhile to break). OTOH, it is just syntactic noise (along with redundant parens in conditions and many other things), and so having a warning (probably opt-in) for it would make sense to me.

This seems firmly in linter/style warning territory. Unlike with other features that are being removed in Swift 3.0, optional semicolons at the end of are utterly harmless: nobody is going to have to reason about them beyond “oh, I can ignore that.

I agree. I am missing the motivation for what harm they are causing.

-Chris


(Joao Nunes) #10

Thank you guys for the emails.

I guess i will have to deal with the fact that we have semicolons for the end of line :slight_smile:

Joao

···

Sent from my iPhone

On 15 Dec 2015, at 23:28, Chris Lattner <clattner@apple.com> wrote:

On Dec 15, 2015, at 12:11 AM, João Nunes <joao3001@hotmail.com> wrote:

In that case why did you accept to remove for loop c style and ++/-- operators? It is the same reasoning.

The rationale for removing them is outlined here:
https://github.com/apple/swift-evolution/blob/master/proposals/0004-remove-pre-post-inc-decrement.md

AFAICT, none of the disadvantages there apply to semicolons, except perhaps the first one (which I’d consider a stretch).

-Chris

Joao

Sent from my iPhone

On 15 Dec 2015, at 06:56, Chris Lattner <clattner@apple.com> wrote:

On Dec 14, 2015, at 3:44 PM, Douglas Gregor <dgregor@apple.com> wrote:

On Dec 14, 2015, at 11:01 AM, Chris Lattner via swift-evolution <swift-evolution@swift.org> wrote:

There are two different topics here, and I’d suggest exploring them separately.

- The semicolon within a line is a expressivity feature.
- The semicolon at the end of the line is accepted, but generally ignored.

Most people seem to be focusing on the second one. IMO, I think that it adds value to the language for people coming from semi-colon oriented languages or bouncing between multiple languages (that muscle memory takes awhile to break). OTOH, it is just syntactic noise (along with redundant parens in conditions and many other things), and so having a warning (probably opt-in) for it would make sense to me.

This seems firmly in linter/style warning territory. Unlike with other features that are being removed in Swift 3.0, optional semicolons at the end of are utterly harmless: nobody is going to have to reason about them beyond “oh, I can ignore that.

I agree. I am missing the motivation for what harm they are causing.

-Chris


(Joao Nunes) #11

Oh and for the muscle memory argument:

Switching from
NSString * var
to
let var:String

Was a bigger effort :smiley:

Joao

···

Sent from my iPhone

On 15 Dec 2015, at 23:28, Chris Lattner <clattner@apple.com> wrote:

On Dec 15, 2015, at 12:11 AM, João Nunes <joao3001@hotmail.com> wrote:

In that case why did you accept to remove for loop c style and ++/-- operators? It is the same reasoning.

The rationale for removing them is outlined here:
https://github.com/apple/swift-evolution/blob/master/proposals/0004-remove-pre-post-inc-decrement.md

AFAICT, none of the disadvantages there apply to semicolons, except perhaps the first one (which I’d consider a stretch).

-Chris

Joao

Sent from my iPhone

On 15 Dec 2015, at 06:56, Chris Lattner <clattner@apple.com> wrote:

On Dec 14, 2015, at 3:44 PM, Douglas Gregor <dgregor@apple.com> wrote:

On Dec 14, 2015, at 11:01 AM, Chris Lattner via swift-evolution <swift-evolution@swift.org> wrote:

There are two different topics here, and I’d suggest exploring them separately.

- The semicolon within a line is a expressivity feature.
- The semicolon at the end of the line is accepted, but generally ignored.

Most people seem to be focusing on the second one. IMO, I think that it adds value to the language for people coming from semi-colon oriented languages or bouncing between multiple languages (that muscle memory takes awhile to break). OTOH, it is just syntactic noise (along with redundant parens in conditions and many other things), and so having a warning (probably opt-in) for it would make sense to me.

This seems firmly in linter/style warning territory. Unlike with other features that are being removed in Swift 3.0, optional semicolons at the end of are utterly harmless: nobody is going to have to reason about them beyond “oh, I can ignore that.

I agree. I am missing the motivation for what harm they are causing.

-Chris