News for hackers. Stuff that matters.
Re:Dhall: A Non-Repetitive Alternative to YAML by nhooyr on Thursday July 04, 2019 @01:46PM (#20356382)
What's with the commas at the start of lines?
Re:Dhall: A Non-Repetitive Alternative to YAML by jbaum98 on Thursday July 04, 2019 @01:49PM (#20356397)
This is a common convention in some languages, most often functional languages in my experience. I associate it most with OCaml.

So it's not so surprising to see it here, seeing as Dhall is written in Haskell.

Re:Dhall: A Non-Repetitive Alternative to YAML by mitchtbaum on Thursday July 04, 2019 @03:14PM (#20357002)
Better Syntax for Lists, Records (and Unions) #66

https://github.com/dhall-lang/dhall-lang/issues/66

Re:Dhall: A Non-Repetitive Alternative to YAML by edoceo on Thursday July 04, 2019 @01:48PM (#20356394)
Makes it easier when commenting out. Use this trick for SQL and JS too (to prevent trailing comma issue)
Re:Dhall: A Non-Repetitive Alternative to YAML by dymk on Thursday July 04, 2019 @01:52PM (#20356425)
I don't get why you'd build a language in 2019 which disallows a trailing comma in lists.
Re:Dhall: A Non-Repetitive Alternative to YAML by andybak on Thursday July 04, 2019 @02:05PM (#20356548)
Yep. 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.
Re:Dhall: A Non-Repetitive Alternative to YAML by twblalock on Thursday July 04, 2019 @04:26PM (#20357492)
The solution is to get rid of them. They are not necessary.
Re:Dhall: A Non-Repetitive Alternative to YAML by Gabriel439 on Friday July 05, 2019 @11:44PM (#20367665)
Author 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.
Re:Dhall: A Non-Repetitive Alternative to YAML by nikolay on Thursday July 04, 2019 @02:16PM (#20356640)
There's absolutely no need for commas in a configuration language, in my opinion.
Re:Dhall: A Non-Repetitive Alternative to YAML by Jeff_Brown on Thursday July 04, 2019 @03:18PM (#20357013)
Dhall does not disallow trailing commas, nor require leading ones.
Re:Dhall: A Non-Repetitive Alternative to YAML by j88439h84 on Thursday July 04, 2019 @02:42PM (#20356813)
Alternatively it could allow leading commas.
Re:Dhall: A Non-Repetitive Alternative to YAML by keymone on Thursday July 04, 2019 @02:49PM (#20356851)
On the other hand - why would you build a language where commas aren’t treated as whitespace?
Re:Dhall: A Non-Repetitive Alternative to YAML by dymk on Thursday July 04, 2019 @02:54PM (#20356879)
You 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}.