4 ms·
god those examples are ugly - commas at the beginning of a line? mismatched brace styles?
by svnpenn 8y ago
god those examples are ugly - commas at the beginning of a line? mismatched brace styles?
- necubi 8y agoIt's a haskell thing. The main advantage is that each line is independent. You can comment out a line or add a line at the end without modifying anything else.
- basil-rash 8y agoEach line is not independent: you cannot comment out the first line. A better approach is to allow trailing commas. (I suppose you could allow leading commas, does Haskell support this?)
- nh2 8y agoUnfortunately no. Allowing trailing commas, like Python does, would be really great. Unfortunately trailing commas already mean something: (a,b,) is a function that still takes 1 argument to make a triple. It's called "TupleSections".
- chriswarbo 8y agoNot sure what you mean by "mismatched brace styles". The convention of putting separators like commas at the start of the following line rather than the end of the preceding line is common in Haskell, which Dhall is built with. The advantages are: - All of the separators are in the same column, along with the opening and closing characters. This makes it trivial to check if we've missed a separator. - Appending new lines to the end will not affect previous lines (i.e. we don't need to go and add a comma). This avoids making mistakes and polluting diffs. Unfortunately the error-prone diff pollution we avoid at the last line instead occurs at the first line. It's still less error-prone than trailing commas, since we can look in the separator column and either spot that it's empty, or that it contains two opening braces (depending on whether we inserted or copy/pasted).