3 ms·
Leading is necessary to minimize diffs when you don't support trailing commas: Prelude> [1,] <interactive>:4:4: error: parse error on input ‘]’ Pr
by masklinn 4y ago
Leading is necessary to minimize diffs when you don't support trailing commas:
Prelude> [1,]
<interactive>:4:4: error: parse error on input ‘]’
Prelude> [1]
[1]
This means if you go multiline in the "usual" style:
[
1,
2,
3
]
any time you need to append a new item, you need to modify the existing last line as well:
[
1,
2,
- 3
+ 3,
+ 4
]
Meanwhile:
[ 1
, 2
, 3
+, 4
]
If you support trailing commas, you can just use one on the last line for the same effect:
[
1,
2,
3,
+ 4,
]
Incidentally, some crazy people put the closing symbol on the last line:
[ 1
, 2
, 3 ]
That completely defeats the point:
[ 1
, 2
-, 3 ]
+, 3
+, 4 ]
- asplake 4y agoDo many/most feel this way? I always felt this argument was the diff tail wagging the code readability dog, so to speak