5 ms·
It's a mystery to me why people won't start using properly designed configuration languages, like Dhall (https://dhall-lang.org/ https://dhall-lang.org/) or Cue
by js8 4y ago
It's a mystery to me why people won't start using properly designed configuration languages, like Dhall (https://dhall-lang.org/ https://dhall-lang.org/) or Cue (https://cuelang.org/ https://cuelang.org/). Even using csexps (https://en.wikipedia.org/wiki/Canonical_S-expressions https://en.wikipedia.org/wiki/Canonical_S-expressions) would be progress.
- andybak 4y agoDepends who the intended audience is. I wouldn't inflict curly braces on anyone other than software developers and certainly not where you expect people to do a lot of manual data entry. Even I tend to write "pseudo-YAML" and then add the JSON line noise programmatically if I'm entering a lot of data.
- Ygg2 4y agoI wouldn't inflict YAML on anyone either. - Oh you used a tab instead of a space. - What do you mean country code can be 'no'? - Sure we are JSON compatible**! - Yeah. 1e3 is an actual string. If it's not. We're not compatible with YAML 1.1 - Yes. I will import your remote exploit.
- oreilles 4y ago> Dhall is a programmable configuration language that you can think of as: JSON + functions + types + imports So like, Typescript but worse ?
- HelloNurse 4y agoMore along the lines of Haskell but Javascript.
- technion 4y agoGithub actions is the one that surprised me. It's a recent enough invention that it was built long after all these discussions, issues raised, and alternatives proposed. I've had far more issues getting these YAML files correctly formatted than I should admit, and every test means pushing a commit and waiting to see what happens.
- cobbal 4y agoAnd one of the root keys in a GitHub action is "on" which will get turned into True by a compliant parser if unquoted
- Master_Odin 4y agoOnly if you use a yaml 1.1 parser. Yaml 1.2 changed the behavior of how booleans are parsed, but it's only been 13 years since it was released, so I get why people might not have migrated to it yet.
- technion 4y agoThis sounds like an example of the problem: It's not up to me to migrate, we're using a third party service and I have no idea what version of Yaml Github Action's parser users. I read this guide and can't find a version referenced anywhere: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions https://docs.github.com/en/actions/using-workflows/workflow-... It refers you to this YAML guide, which itself never mentions what version it's helping you learn: https://learnxinyminutes.com/docs/yaml/ https://learnxinyminutes.com/docs/yaml/
- Epa095 4y ago> and every test means pushing a commit and waiting to see what happens. I use nekos act to run workflows locally (and it does not support reusable workflows), but it sure helped me to get the yaml right.
- edflsafoiewq 4y agoYAML lets you easily embed sh scripts run: | mkdir build && build cmake .. etc. This is great for CI.
- mike_hock 4y ago> You can import Dhall expressions from URLs that support CORS We seem to have very different ideas of what a "configuration language" should be capable of and what its parser should (be allowed to) do.
- js8 4y agoNot really, Dhall is strongly normalizing, it cannot execute typical programs.
- infogulch 4y agoTo add to siblings comment, dhall can only load resources from URLs if it's annotated with the hash of its content. The "language" itself is explicitly not turing complete, and is fully deterministic. Look a little closer, dhall is probably the best option I've seen that preserves the properties I want out of a configuration language (correctness, determinism, turing incompleteness, easy projection into other formats, etc).
- mike_hock 4y agoOk, I don't want the language to be Turing-complete (checked), but I also don't want the parser to open network sockets.
- infogulch 4y agoThat's reasonable. Please note: > However, when you protect an import with a semantic integrity check the import is permanently locally cached after the first request, so subsequent imports will no longer make outbound HTTP requests. Also this PR to nixpkgs from 2020: https://github.com/NixOS/nixpkgs/pull/79900 https://github.com/NixOS/nixpkgs/pull/79900 > Many users have requested Dhall support for "offline" packages ... The goal of this change is to document what is the idiomatic way to implement "offline" Dhall builds ... The trick to implementing offline builds in Dhall is to take advantage of Dhall's support for semantic integrity checks. ... The offline nature of the builds are enforced by compiling the Haskell interpreter with the -f-with-http flag ... https://docs.dhall-lang.org/discussions/Safety-guarantees.html https://docs.dhall-lang.org/discussions/Safety-guarantees.ht...
- pkrumins 4y agoThe answer to this mystery is that no one has heard about these esoteric languages.
- BiteCode_dev 4y agoI did, and they are very underrated. CUE in itself is brillantly designed: just enough power to be useful (conditionals, loops), but not enough to be dangerous (not turing complete). The idea that you can define data types and data values with the same language makes for very ergonomic configuration files, and it is compatible with YAML and JSON, being able to export to and validate them. Any new tech is esoteric at first. When I started Python 20 years ago, there were no job offer for it in my country.
- teekert 4y agoYaml is nice, its a shame MS Word does not support it (with syntax checking of course) or its adoption would be even greater. It just looks nice and non coders easily get the hang of it.
- js8 4y agoYou're the 2nd person in the reply who worries about non-coders. Honest question - what is the example use case here? Which configuration files in YAML are currently being handled by people who don't know any coding, and would be impeded by curly braces (and anything like JSON or XML)? I think this is only an imagined problem. Also, I have a met a non-programmer lady from HR, who was able to download a VB script into Outlook and adapt it to her needs (which was some kind of automation). Richard Stallman made a similar observation with Emacs configuration. I think you quite underestimate what non-programmers can do.
- BiteCode_dev 4y agoI'm a big fan of Cue, but it's stuck in Golang. If I where to use it in Python, I would have to code a parser, then implement the entire type logic mysql. And I bet this is why it's not more used: JSON or YAML are comparatively easy to implement because you just need the parser. You don't have a full featured language with a set based typing system on top.
- formerly_proven 4y agoI have a weak spot for S-exprs and tend to use them when nobody will be looking. There's just something very nice and right-looking about them, and the "correct" pretty-printing is algorithmically very simple, parsing is easy, when indented they're easy to read and edit even if the file gets a bit longer etc.
- AlphaSite 4y agoI don’t know much about dhall, but Cue is one of the worst pieces of software I’ve ever used. It’s clearly been designed by someone who’s so proud of their own cleverness that they never considered if any of it is actually useable or not.
- lytedev 4y agoI've been using cue for all my personal config, so I'm curious! What are these terrible issues you've encountered?
- samatman 4y agoWhy pay for what you're not using? Sometimes you want to let a user edit some fields in a map/dict/whatever, and that's it. I use TOML here, personally, but YAML has some advantages for more complex data, especially if string keys are long. Not everyone is trying to set up a Kube cluster.
- neilv 4y agoPeople who've learned a Lisp family language offer our hopes and prayers that people using these configuration languages don't miss a comma, space, newline, or optional quote. :) ((name "Ford Prefect") (age 42) (possessions "Towel")) (:name "Ford Prefect" :age 42 :possessions ("Towel")) (countries "GB" "IE" "FR" "DE" "NO") (countries gb ie fr de no) ; if country codes are identifiers in a DSL ((first-name "Christopher") (surname "Null")) (:first-name "Christopher" :surname "Null")
- chipotle_coyote 4y agoIt may be because for many use cases -- probably most, statistically, although that's just an intuition -- what you're really looking for is a configuration data format, not a full-blown language. You need key-value pairs, probably nested, and... that may very well be it. It may not even matter if the data format can explicitly specify data type. Dhall and Cue are no doubt excellent and amazing for complicated use cases, but there are a lot of use cases where using them is akin to taking the VTOL jet out to pick up a few things at Trader Joe's.
- fesc 4y agoI disagree. Yeah, you always start out with K/V pairs but it never takes long until you need the same configuration but just with a slight tweak here or there. For example consider the same configuration but for different running environments. People always come up with custom solutions per tool which some sort of metaprogramming, again in YAML. This is just bonkers IMO. So why not just use a proper language from the beginning?
- HelloNurse 4y agoBoth XML and s-expressions have a great formal advantage over JSON or YAML and most of their derivatives: the ease of being explicit by means of using names and types allows applications to process their configuration freely rather than according to inappropriately high level conventions. (server-addresses) (server-addresses (ipv4 "10.255.5.5:801") (localhost) (ipv6 "1234::5678") (ipv4 "10.255.25.25:8001")) (list (server (address (ipv4 "10.255.5.5")) (port "801") (allowed-countries (list "se" "no" "dk" "fi")) ) (server (name "nil") (allowed-countries nil) (address (ipv6 "1234::5678") )))