Skip to content

Commit d1ebb53

Browse files
committed
SIP-27: Briefly explain why no single-line trailing commas
1 parent 3f11780 commit d1ebb53

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

sips/completed/_posts/2016-06-25-trailing-commas.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ It is not the intent of introducing trailing commas to promote a code style such
105105
val xs = Seq(foo, baz, bar, )
106106
{% endhighlight %}
107107

108+
for a number of reasons:
109+
110+
1. Subjectively, it's an ugly style.
111+
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.
112+
3. Adding or removing elements is less cumbersome on one line.
113+
4. Commenting out elements isn't any less cumbersome with an optional trailing comma.
114+
108115
Trailing comma support is therefore restricted to only comma-separated elements that are on separate lines:
109116

110117
{% highlight scala %}

0 commit comments

Comments
 (0)