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.
[ Parent
| on HN ]
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}.