10000 SIP-27: Trailing Commas, revised document by dwijnand · Pull Request #625 · scala/docs.scala-lang · GitHub
[go: up one dir, main page]

Skip to content

SIP-27: Trailing Commas, revised document #625

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 11 commits into from
Nov 25, 2016
Merged
Prev Previous commit
Next Next commit
SIP-27: Briefly explain why no single-line trailing commas
  • Loading branch information
dwijnand committed Nov 24, 2016
commit d1ebb53f3257ad27b34d09833af76b2c86872294
7 changes: 7 additions & 0 deletions sips/completed/_posts/2016-06-25-trailing-commas.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ It is not the intent of introducing trailing commas to promote a code style such
val xs = Seq(foo, baz, bar, )
{% endhighlight %}

for a number of reasons:

1. Subjectively, it's an ugly style.
2. Some people utilise commas as a mechanism for counting, so introducing an optional trailing commas interferes with this technique; when elements are one by line, then line-counting can be used.
3. Adding or removing elements is less cumbersome on one line.
4. Commenting out elements isn't any less cumbersome with an optional trailing comma.

Trailing comma support is therefore restricted to only comma-separated elements that are on separate lines:

{% highlight scala %}
Expand Down
0