Code Monkey home page Code Monkey logo

Comments (24)

funkyboy avatar funkyboy commented on June 11, 2024

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.

hollance avatar hollance commented on June 11, 2024

A reasonable except to multiple statements on one line would be closures.

from swift-style-guide.

ColinEberhardt avatar ColinEberhardt commented on June 11, 2024

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.

hollance avatar hollance commented on June 11, 2024

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.

ColinEberhardt avatar ColinEberhardt commented on June 11, 2024

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.

funkyboy avatar funkyboy commented on June 11, 2024

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.

Paradox927 avatar Paradox927 commented on June 11, 2024

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.

 avatar commented on June 11, 2024

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.

funkyboy avatar funkyboy commented on June 11, 2024

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.

icanzilb avatar icanzilb commented on June 11, 2024

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.

 avatar commented on June 11, 2024

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.

 avatar commented on June 11, 2024

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.

hollance avatar hollance commented on June 11, 2024

No for loops then. :-(

from swift-style-guide.

rnystrom avatar rnystrom commented on June 11, 2024

Absolutely not :)

from swift-style-guide.

jackwu95 avatar jackwu95 commented on June 11, 2024

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.

 avatar commented on June 11, 2024

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.

 avatar commented on June 11, 2024

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.

hollance avatar hollance commented on June 11, 2024

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.

 avatar commented on June 11, 2024

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.

 avatar commented on June 11, 2024

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.

gregheo avatar gregheo commented on June 11, 2024

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.

 avatar commented on June 11, 2024

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.

ColinEberhardt avatar ColinEberhardt commented on June 11, 2024

(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.

gregheo avatar gregheo commented on June 11, 2024

Sorry, I closed it by accident. We like pedantic...it is a style guide, after all ;]

from swift-style-guide.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.