4 ms·
Makes it easier when commenting out. Use this trick for SQL and JS too (to prevent trailing comma issue)
by edoceo 7y ago
Makes it easier when commenting out. Use this trick for SQL and JS too (to prevent trailing comma issue)
- dymk 7y agoI don't get why you'd build a language in 2019 which disallows a trailing comma in lists.
- andybak 7y agoYep. The solution to comma issues isn't to put every single one in a place nobody usually puts them - it's to be more forgiving about allowing the occasional trailing one.
- twblalock 7y agoThe solution is to get rid of them. They are not necessary.
- Gabriel439 7y agoAuthor here: commas are necessary to separate list elements in any language where function application uses whitespace (i.e. Haskell-style function application). If you're not familiar with the syntax, an expression like `f x y z` is a function `f` applied to three arguments (`x`, `y`, and `z`), analogous to `f(x, y, z)` in a more traditional language. Nix made this mistake of using whitespace to separate list elements AND using whitespace to separate a function from its argument and it is a very common pain point for new users, because they will write something like this: [ theFunction theFunction'sArgument ] ... thinking it will be parsed as: [ (theFunction theFunction'sArgument) ] ... but it actually gets parsed as a list with two elements, leading to a bizarre type error.
- nikolay 7y agoThere's absolutely no need for commas in a configuration language, in my opinion.
- j88439h84 7y agoAlternatively it could allow leading commas.
- keymone 7y agoOn the other hand - why would you build a language where commas aren’t treated as whitespace?
- dymk 7y agoYou could absolutely do this as well. I'm just taking issue with a language that constrains you in such a way that you have to put the commas at the beginning of the list elements, so it plays nicely with {comments, source control blame}.
- Jeff_Brown 7y agoDhall does not disallow trailing commas, nor require leading ones.