Skip to content

[Gardening] Replaced many instances of ' : ' with ': ' #26218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2019
Merged

[Gardening] Replaced many instances of ' : ' with ': ' #26218

merged 1 commit into from
Jul 18, 2019

Conversation

twostraws
Copy link
Contributor

Following guidance from Karoy that the current stdlib style is not to put a space before most colons (https://twitter.com/lorentey/status/1151899985849417728?s=20), this PR adjusts many instances of " : " to be ": ".

There are two notable exceptions:

  1. Use of the ternary operator is an entirely different context and has been left untouched.

  2. Some instances of conformance are written such that the colon is the first thing on a new line. This wasn't common, but I can see this as being sufficiently different to be changed separately if at all.

@@ -382,7 +382,7 @@ precedencegroup BitwiseShiftPrecedence {
// Standard postfix operators.
postfix operator ++
postfix operator --
postfix operator ... : Comparable
postfix operator ...: Comparable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section with the operators is the only place where I prefer having a space before the colon, but it's probably not worth the exception. Anyone else?

Otherwise LGTM! Thanks @twostraws!

@natecook1000
Copy link
Member

@swift-ci Please smoke test

@vmartinelli
Copy link

vmartinelli commented Jul 18, 2019

Other than the quoted tweet, where are the other sources for adopting this coding style?

I understand that in the definition of a variable (or property) type the omission of space is fair, but for dictionaries and similar cases this is not the ideal solution.

They are different things and they have different semantics.

@lorentey
Copy link
Member

@vmartinelli For some rationalization, see this old forum post: https://forums.swift.org/t/rfc-space-or-not-to-space/18657/5?u=lorentey

At the end of the day, these are completely arbitrary choices.

@lorentey lorentey self-requested a review July 18, 2019 20:50
Copy link
Member

@lorentey lorentey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. The edge cases are rare and we can always resolve them later. (Formatting when there is a line break around the colon & spacing in operator decls.)

@vmartinelli
Copy link

@lorentey Thank you for the comment and the thread link. 🙂

("At the end of the day, these are completely arbitrary choices": I could not find a better definition for certain recent Swift-related decisions.)

@stephentyrone
Copy link
Contributor

Thanks @twostraws !

@lorentey lorentey merged commit da61cc8 into swiftlang:master Jul 18, 2019
@airspeedswift
Copy link
Member

("At the end of the day, these are completely arbitrary choices": I could not find a better definition for certain recent Swift-related decisions.)

@vmartinelli this is not a helpful comment, please keep things constructive if you want to participate in discussions on PRs

@vmartinelli
Copy link

@vmartinelli this is not a helpful comment, please keep things constructive if you want to participate in discussions on PRs

@airspeedswift Pardon. I did not mean to offend anyone. In fact, my post scriptum was not really addressed to everyone. It was meant only to the crazy ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants