Skip to content

[gardening] Increase consistency with regards to spacing after colons #4855

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 23, 2016
Merged

[gardening] Increase consistency with regards to spacing after colons #4855

merged 1 commit into from
Sep 23, 2016

Conversation

practicalswift
Copy link
Contributor

Increase consistency with regards to spacing after colons.

@practicalswift
Copy link
Contributor Author

@swift-ci please smoke test

@practicalswift
Copy link
Contributor Author

@swift-ci please test

@practicalswift
Copy link
Contributor Author

@swift-ci please smoke test and merge

@moiseev
Copy link
Contributor

moiseev commented Sep 19, 2016

AFAIK, the rule of thumb is "add a space on the type-side of the colon". So in generics it would be <T : Collection> but in parameters -- x: MyCollection.
Can you please update the PR?

@moiseev moiseev self-assigned this Sep 19, 2016
@practicalswift
Copy link
Contributor Author

@moiseev The form <T: Collection> is used consistently (instead of <T : Collection>) in the Apple Swift book. Should I go with <T: Collection> or <T : Collection>? :-)

@practicalswift
Copy link
Contributor Author

I've now removed all <X : Y> vs. <X: Y> changes from this PR to make it merge:able :-)

@practicalswift
Copy link
Contributor Author

@swift-ci please smoke test

@moiseev
Copy link
Contributor

moiseev commented Sep 22, 2016

@practicalswift FWIW, the <T : P> convention (with two spaces) is what we tend to use in the Standard Library. The fact it is not what is used in the book is really unfortunate.

@practicalswift
Copy link
Contributor Author

@swift-ci please smoke test

@practicalswift
Copy link
Contributor Author

@swift-ci please test

@practicalswift
Copy link
Contributor Author

@moiseev OK, then let's go with <T : P> then! :-)

Is there someone in the Swift team who is in contact with the Swift book team and can bring up this inconsistency and get it resolved? :-)

@practicalswift
Copy link
Contributor Author

@swift-ci please smoke test and merge

@practicalswift practicalswift merged commit c4a6c05 into swiftlang:master Sep 23, 2016
@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - ef8e43b
Test requested by - @practicalswift

@practicalswift
Copy link
Contributor Author

@moiseev FWIW <T: P> (the style used in the Swift book) seems to be preferred in this unscientific poll with 178 respondents: https://twitter.com/practicalswift/status/750349404452913153

Results:

  • class A<T: B where …> { (used in the Swift book) – preferred by 82 %
  • class A<T : B where …> { (used in the standard library) – preferred by 11 %
  • class A<T:B where …> { (control group, used by whom?) – preferred by 7 %

@moiseev
Copy link
Contributor

moiseev commented Sep 26, 2016

Nice! It might be a consequence of people using XCode and reading TSPL, though.
Let's agree for now, that <A : B> is what is used in the standard library. We also have some other differences from the book/xcode styles: like 2-space indentation, and 80 characters width.

@practicalswift
Copy link
Contributor Author

@moiseev Agreed! 👍

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.

3 participants