Skip to content

Remove spaces in range operators #104

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
Sep 17, 2019
Merged

Remove spaces in range operators #104

merged 1 commit into from
Sep 17, 2019

Conversation

PopFlamingo
Copy link
Contributor

@PopFlamingo PopFlamingo commented Sep 13, 2019

This is a question of preference, but it looks like the most commonly used format for ranges in Swift projects is what can be found in the Swift Book where there is no space between the values and range operators, for instance: case 200..<300: contrary to the current case 200 ..< 300.

What do you think? 🙂

@artemredkin artemredkin requested a review from tomerd September 15, 2019 19:05
@tomerd
Copy link
Contributor

tomerd commented Sep 16, 2019

no strong opinion here

@artemredkin artemredkin requested a review from Lukasa September 16, 2019 15:11
Copy link
Collaborator

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

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

LGTM>

Copy link
Contributor

@ktoso ktoso left a comment

Choose a reason for hiding this comment

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

Funnily enough we had the same discussion recently and arrived at keeping the space...

Argument made by @drexin was that for .min ... .max a space is needed, e.g. Int.random(in: .min ... .max) or similar APIs.

Though the google style guide https://google.github.io/swift/#horizontal-whitespace does indeed claim an exception for the ... operators.

I personally was convinced by the .max argument, but if people want to stick to google rule here let's go with it. 🤔

@PopFlamingo
Copy link
Contributor Author

PopFlamingo commented Sep 17, 2019

@ktoso Makes sense too, although personally I would prefer parenthesising or disambiguating with TypeName.foo (in this case).

@artemredkin artemredkin self-requested a review September 17, 2019 12:26
@artemredkin artemredkin merged commit 6efe214 into swift-server:master Sep 17, 2019
@artemredkin
Copy link
Collaborator

thanks, @adtrevor !

@PopFlamingo PopFlamingo deleted the format branch September 17, 2019 12:38
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.

5 participants