Comment by chillfox
3 years ago
Yeah, I think it's because nobody sat down and methodically created it.
People create config languages that work for their use case and then it is just a happy accident if it works for other things.
I don't think anyone has put serous effort into designing a configuration language. And by that I mean collect use cases, study how other config languages does things, make drafts, and test them. etc...
Terraforms HCL is well designed.
I know a lot of people hate it but I find it to be the only configuration language that makes any sense for moderately large configs.
It’s short, readable, unambiguous, great IDE support. Got built in logic, variables, templates, functions and references to other resources - without being Turing complete imperative language, and without becoming a xml monstrosity.
Seriously there is nothing even close to it. Tell me one reasonable alternative in wide use that’s not just some preprocessor bolted onto yaml, like Helm charts or Ansible jinja templates.
There's a world of difference between "simple configuration needs" and "complex configuration needs".
I will take a kubernetes deployment manifest as an example that you would want to express in a hypothetically perfect configuration language. Now, eventueally, you end up in the "containers" bit of the pod template inside the deployment spec.
And in that, you can (and arguably should) set resources. But, in an ideal world, when you set a CPU request (or, possibly, limit, but I will go with request for now) for an image that has a Go binary in it, you probably also want to have a "GOMAXPROCS" environment variable added that is the ceiling of your CPU allocation. And if you add a memory limit, and the image has a Java binary in it, you probably want to add a few of the Java memory-tuning flags.
And it is actually REALLY important that you don't repeat yourself here. In the small, it's fine, but if you end up in a position where you need to provide more, or less, RAM or CPU, on short notice (because after all, configuration files drive what you have in production, and mutating configuration is how you solve problems at speed, when you have an outage), any "you have to carefully put the identical thing in multiple places" is exactly how you end up with shit not fixing themselves.
So, yeah, as much hate as it gets, BCL may genuinely be better than every other configuration language I have had the misfortune to work with. And one of the things I looked forward to, when I left the G, was to never ever in my life have to see or think about BCL ever again. And then I saw what the world at large are content with. It is bloody depressing is what it is.
Cuelang?
Yeah absolutely. I think there are four corners to the square: "meant to be written by humans/meant to be written by computers" and "meant to be read by humans/not meant to be read by humans". JSON is the king of meant to be written by computers read by humans, grpc and swift and protobuf and arrow can duke it out the written by computer/not read corner. We are missing good options in written by humans half.
Dhall and Cue come to mind as ones that _feel_ more designed
https://github.com/dhall-lang/dhall-lang
https://cuelang.org/docs/usecases/configuration/
Interesting...
Me, the programmer finds those kinda cool.
And the sysadmin in me developed a dislike of both within 1 minute of looking at them.
Honestly, I think a good configuration library should be more than a spec, it should come with a library that handles parsing/validation. See, there are two sides to configuration, the user and the program. Knowledge about the values, defaults and types should live on the program side and should be documented. Then the user side of configuration can be clean and easy to read/write and most important of all, allow the user to accomplish the most common configuration without having to learn a new config language on top of learning the application.
> Honestly, I think a good configuration library should be more than a spec, it should come with a library that handles parsing/validation
You just described CUELang.
The type system allows to define a schema as well as the data, in the same file, or in 2 separate ones. Then you can call either a cli tool (that works on linux, windows or mac) or use the Go lib (or bind to it).
For compat, cue can import and export to yaml, json and protobuf, as well as validate them.
4 replies →
> Yeah, I think it's because nobody sat down and methodically created it.
I think it's the opposite. There isn't a single config file that suits all needs.
Especially when you realize config isn't a single thing.
http://mikehadlow.blogspot.com/2012/05/configuration-complex...
I guess that could also be the case.
I haven’t studied it, I am just generally feeling unhappy about most software configuration.