SE-0250: Swift Code Style Guidelines and Formatter

Thoughts on where to take this discussion

The direction I think this discussion should go is to break it apart into two parts:

  • The style guide itself
  • Technology to support formatting

The two are related, but also policies about both are getting conflated in this discussion. Whether or not Swift gets an "official" or "recommended" style guide is related, but separate, from whether or not there should be formatting technology supported directly or indirectly by the Swift project. Similarly, having an agreed upon style is something we could have without an official formatter.

I think there is real value in discussing formatting technology supported by the Swift project. That discussion should be focused on building technology — which would go in the Development section of the forums. Building technology is something we do routinely with open discussion, but we don't take those through the Evolution process. The purpose of the Evolution process is to discuss changing the definition of the language or API surface of the Standard Library. One motivator for focusing on building such technology support is that the Language Server Protocol supports formatting in its API surface, which is not all that surprising since most engineers expect that editors can perform some amount of code formatting as a standard editing operation. How such code formatting should be configurable or what underlying technology is used to support that is something we can discuss in the forums independent of this style guide. But this does feel like an important direction in the project for Swift to support in some way— irrespective if there is an official style guide or not.

Regarding the official style guide, fundamentally it feels like such a discussion needs to focus around having an actual style guide for the community to discuss. I think there's enough feedback in this review that a style guide would be welcome by a good portion of the community, but that it depends on the details. That's where I think this particular discussion should pick up.

Given the nature of a discussion about an actual style guide with the immense attention that would gather from the community (not to mention limitations on my own time in the near term) I suspect such a discussion at the earliest would come about in June. There are a variety of proposals that need to be considered for Swift 5.1 in the near term, and I want to make sure the community as a whole can focus on important topics with adequate time and attention.

I will hold this thread open a little longer, but then likely suspend it to match with the review itself being suspended.

27 Likes