Comments (24)
Agree on this. Which leads me to say: "no multiple statements on one line", otherwise we'd need semicolons and we don't want them :)
from swift-style-guide.
A reasonable except to multiple statements on one line would be closures.
from swift-style-guide.
A reasonable except to multiple statements on one line would be closures.
True, but those don;t require the usage of a semicolo
from swift-style-guide.
I had this in mind:
{ a, b in a = do something; return something with b and a }
If that is short enough to fit on a single line, then why not. Very hypothetical situation, though.
from swift-style-guide.
If that is short enough to fit on a single line, then why not.
Would you do this in Objective-C or any other language?
from swift-style-guide.
My opinion is that a single line like that looks very "script-y", like ruby of python, so it might lead me to interpret that using the semantics of a scripting language, instead of the Swift one.
from swift-style-guide.
Apple made a big deal out of no semicolons; mentioning it many times in various sessions. While personally I don't want to drop it, I think it makes sense to do just that - drop it, and not use it (except, of course, where it's needed).
from swift-style-guide.
Swift has the semantics of a scripting language. That is one of its promoted benefits.
--------- Original Message --------- Subject: Re: [swift-style-guide] Semicolons at the end of lines (#8)
From: "Cesare" [email protected]
Date: 6/10/14 7:48 am
To: "raywenderlich/swift-style-guide" [email protected]
My opinion is that a single line like that looks very "script-y", like ruby of python, so it might lead me to interpret that using the semantics of a scripting language, instead of Swift.
Reply to this email directly or view it on GitHub.
from swift-style-guide.
Nope.
`
var a = "aaa"
a = 12
`
In js is perfectly valid, in Swift throws a compile time error.
Deja vu @ColinEberhardt :)
Anyway let's stop it here.
NO SEMICOLONS.
from swift-style-guide.
I know you already discussed that guys, but can I only add - no semicolons!
On Tuesday, June 10, 2014, Cesare [email protected] wrote:
Nope.
`
var a = "aaa"a = 12
`In js is perfectly valid, in Swift throws a compile time error.
Deja vu @ColinEberhardt https://github.com/ColinEberhardt :)
Anyway let's stop it here.
NO SEMICOLONS.—
Reply to this email directly or view it on GitHub
#8 (comment)
.
from swift-style-guide.
The syntax of Swift is like a scripting language. I didn't say it was like that specific scripting language
--------- Original Message --------- Subject: Re: [swift-style-guide] Semicolons at the end of lines (#8)
From: "Cesare" [email protected]
Date: 6/10/14 10:43 am
To: "raywenderlich/swift-style-guide" [email protected]
Cc: "elephantronic" [email protected]
Nope.
var a = "aaa" a = 12
In js is perfectly valid, in Swift throws a compile time error.
Deja vu @ColinEberhardt :)
Anyway let's stop it here.
NO SEMICOLONS.
Reply to this email directly or view it on GitHub.
from swift-style-guide.
Semi colons were never an option. Colin only made this issue as a joke. As a tech editor, I will be rejecting any article/chapter that includes semi colons, so you had best do a grep before submitting
--------- Original Message --------- Subject: Re: [swift-style-guide] Semicolons at the end of lines (#8)
From: "Marin Todorov" [email protected]
Date: 6/10/14 10:47 am
To: "raywenderlich/swift-style-guide" [email protected]
Cc: "elephantronic" [email protected]
I know you already discussed that guys, but can I only add - no semicolons!
On Tuesday, June 10, 2014, Cesare [email protected] wrote:
Nope.
`
var a = "aaa"a = 12
`In js is perfectly valid, in Swift throws a compile time error.
Deja vu @ColinEberhardt https://github.com/ColinEberhardt :)
Anyway let's stop it here.
NO SEMICOLONS.Reply to this email directly or view it on GitHub
#8 (comment)
.Reply to this email directly or view it on GitHub.
from swift-style-guide.
No for loops then. :-(
from swift-style-guide.
Absolutely not :)
from swift-style-guide.
I think no semicolons anywhere.
Even
for (i = 0; i < n; i++)
should be switched to
for i in 0..8
from swift-style-guide.
you can write plenty of for loops without semi colons, mister. If you use a semi colon, you'd better have a damn good reason.
--------- Original Message --------- Subject: Re: [swift-style-guide] Semicolons at the end of lines (#8)
From: "Matthijs Hollemans" [email protected]
Date: 6/10/14 11:23 am
To: "raywenderlich/swift-style-guide" [email protected]
Cc: "elephantronic" [email protected]
No for loops then. :-(
Reply to this email directly or view it on GitHub.
from swift-style-guide.
I agree, Jack.
--------- Original Message --------- Subject: Re: [swift-style-guide] Semicolons at the end of lines (#8)
From: "Jack Wu" [email protected]
Date: 6/10/14 11:57 am
To: "raywenderlich/swift-style-guide" [email protected]
Cc: "elephantronic" [email protected]
I think no semicolons anywhere.
Even
for (i = 0; i < n; i++)
should be switched to
for i in 0..8
Reply to this email directly or view it on GitHub.
from swift-style-guide.
How about...
for var i = 0; i < 100; i += 2 { ... }
You can't write that with a for i in 0..100
loop.
from swift-style-guide.
So you have a reason. When I am editing your code, I'll let that semicolon through. If I see an unnecessary semicolon, I will reject you. Rejected!
--------- Original Message --------- Subject: Re: [swift-style-guide] Semicolons at the end of lines (#8)
From: "Matthijs Hollemans" [email protected]
Date: 6/10/14 12:44 pm
To: "raywenderlich/swift-style-guide" [email protected]
Cc: "elephantronic" [email protected]
How about...
for var i = 0; i < 100; i += 2 { ... } You can't write that with a for i in 0..100 loop.
Reply to this email directly or view it on GitHub.
from swift-style-guide.
And the reason I say to grep is because I find myself typing semicolons out of habit, so I am searching for them to remove them. ;)
--------- Original Message --------- Subject: Re: [swift-style-guide] Semicolons at the end of lines (#8)
From: "Matthijs Hollemans" [email protected]
Date: 6/10/14 12:44 pm
To: "raywenderlich/swift-style-guide" [email protected]
Cc: "elephantronic" [email protected]
How about...
for var i = 0; i < 100; i += 2 { ... } You can't write that with a for i in 0..100 loop.
Reply to this email directly or view it on GitHub.
from swift-style-guide.
All right: No line-ending semicolons. "Classic" for loops are ok; whether we should do compact closures that can fit on a line can be argued elsewhere.
I also notice some of you are using non-standard smileys in the comments here! ;]
from swift-style-guide.
Different issue, but we should promote the newer ranged loops when they make sense. So classic for loops should still be the exception rather than the rule
--------- Original Message --------- Subject: Re: [swift-style-guide] Semicolons at the end of lines (#8)
From: "Greg Heo" [email protected]
Date: 6/11/14 9:53 am
To: "raywenderlich/swift-style-guide" [email protected]
Cc: "elephantronic" [email protected]
All right: No line-ending semicolons. "Classic" for loops are ok; whether we should do compact closures that can fit on a line can be argued elsewhere.
I also notice some of you are using non-standard smileys in the comments here! ;]
Reply to this email directly or view it on GitHub.
from swift-style-guide.
(re-opened) Sorry to be pedantic, but I think issues should only be closed via pull requests that update the style guide. I'd be happy to add a section on semicolon usage as we appear to be in broad agreement here.
from swift-style-guide.
Sorry, I closed it by accident. We like pedantic...it is a style guide, after all ;]
from swift-style-guide.
Related Issues (20)
- Make the linter a dotfile HOT 2
- [email protected] HOT 1
- New line in functions. Not good. HOT 2
- Please add `no_extension_access_modifier` as a default SwiftLint rule HOT 1
- Please Add SwiftUI style guide
- https://ideas.accredible.com/changelog/functionality-for-a-messagenotification-to-be-added-over-an-issued-credential
- edge://credits/ HOT 1
- Clean code
- Function Declarations HOT 1
- 4-space indentation. HOT 2
- False positive from array_constructor custom rule
- how to write switch statement HOT 1
- Preferred type inference of static vars inside extensions HOT 4
- Pls update Readme file to reflect the newest changes in `if let` syntax introduced in Swift 5.7 HOT 1
- unused_import does not seem to be working HOT 1
- Function Calls vs Function Declarations HOT 2
- `unused_import` should be listed in the `analyzer_rules`
- SwiftLint 'attributes' rule flags property wrappers HOT 2
- Function calls format
- Revisit ternary operator section
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift-style-guide.