News for hackers. Stuff that matters.
Re:Apple releases Pkl – configuration as code language by msoad on Saturday February 03, 2024 @06:47AM (#39239458)
JSONSchema covers a lot of various schema needs and YAML is something a lot of developers are comfortable with. I know both of those technologies are not popular here in HN but YAML type-checked and editor-autocomplete-enabled using JSONSchema is a solid choice for configurations in my opinion.
Re:Apple releases Pkl – configuration as code language by iamflimflam1 on Saturday February 03, 2024 @06:56AM (#39239507)
Every time I see YAML used for any configuration I know I’m in a frustrating time. It’s particularly bad for build systems where there the feedback time can be so slow.
Re:Apple releases Pkl – configuration as code language by bbkane on Saturday February 03, 2024 @09:09AM (#39240468)
I agree it doesn't scale well as there are no loops/functions, but there's a lot of good tooling around YAML that other config languages lack:

- mature libs for most languages

- VScode plugin + Jsonschema for auto completion / schema checking

- yamllint to detect the languages footguns

- yq to query, update in place, and format while preserving comments and sorting keys from the CLI

Re:Apple releases Pkl – configuration as code language by baq on Saturday February 03, 2024 @07:39AM (#39239795)
Jsonschema is still json and yaml is absolutely not comfortable to work with. It’s only enough for simple configs. As soon as you have the urge to use a template you should replace it with something else.
Re:Apple releases Pkl – configuration as code language by whacked_new on Saturday February 03, 2024 @02:19PM (#39243755)
I use jsonnet for templating and transformation and jsonschema for validation. Very happy with this combination. One big reason is that there are lot of libraries and codegen tools to choose from once you have the JSON generation pipeline (including schema generation) down.
Re:Apple releases Pkl – configuration as code language by Szpadel on Saturday February 03, 2024 @07:04AM (#39239554)
true, but as name suggests jsonschema wasn't meant for yaml it's only because yaml is superset of JSON. the issue is that when you want or need to use something that is outside of JSON spec, like tags all your validation falls apart. also JSON schea validation is really basic, and while designing configuration format can often mitigate that, it's not very versatile.

another common thing is that sometimes you have to define multiple very similar sections in configuration that cannot be handled with yaml archors, eg I have repeated definition dozen times that changes only in 2 numbers that are deeply in structure and name string, and I need to repeat everything because of that and it's pita to modify all other parameters that need to be kept in sync

therefore I think this format looks really nice, although I'm concerned by loops that can be used there, is there possible to create simple config that takes ages to parse or consume very large amounts of memory?