Live data from Hacker News

Pkl, a Programming Language for Configuration

pkl-lang.org

341–350 of 598 posts

Re: Pkl, a Programming Language for Configuration

#341

Earlier quoted context omitted.

Guess the obvious question is why don’t you want types in your config language? Pushing all the validation to parsing state just makes it hard to write valid config, because you only know if the config is valid when you feed it into your program. Having the ability to pull all that validation forward, and into your IDE, means you can be told about invalid config as you’re writing it. To me the idea of only wanting to…

My take on this is that there is not obvious reason not to, but it just so happens that typed configuration languages are not rich enough and not integrated enough to be that useful. Those languages that arrived with the JSON hype train like yaml or toml might be great for dynamic languages, where you can load them to some native object. But in statically typed languages you are gonna declare your types, in code, any…

Yaml predates toml by ten years or so _and_ has an extensible schema to define types.

Sadly, nobody ever cared about that.

Re: Pkl, a Programming Language for Configuration

#342
I might sound like heretic but as someone who always keeps an eye out for configuration systems (I've tried edn, raw json, dhall, cue, hcl to name a couple) over the years, I'm sticking to jsonnet + jsonschema. Some reasons in favor of what might seem like an antiquated / type-poor system:

  - jsonnet fixes almost all of the superficial complaints people have about json (no comments, invitations to inconsistent layouts, no composition, no functions)
  - jsonnet has a very handy formatter and has trailing commas (simple diffs)
  - jsonnet can import jsonnet as well as json so you can "refactor" your configs using code and/or plain data
  - json is everywhere and nearly every language has a parser the standard libraries
  - jsonnet is not turing complete; I consider this a huge plus as effectively you are always operating in "data space"; everything is a shape transform, nothing more, nothing less
  - you can do further slicing and dicing with other mature tools like jq, jc, yq, gron, whatever
  - your outputs being plain old json, leverage whatever json schema ecosystem tools you have
  - json schema being old, you have lots of codegen tools available
  - the jsonnet library has go, python, node, C++ bindings
  - super easy to learn and run interactively
the biggest thing that's sorely lacking in this ecosystem are whatever jsonschema doesn't support in its spec for validation, like complex XOR relationships. Sometimes I wish these are declarable in data space, but on the other hand, configs with complex relationships like these often have business code backing them. Another weakness is if you have a large anthology of schemas/templates/source data you need to figure out a management method and hierarchy yourself.

Maybe pkl has a nice answer to these but J+J is really quite robust. I'd even go further and say it's beneficial to adopt a schema-first mindset and make it a habit to generate schemas. These tools are so lightweight and ubiquitous, it makes quick work for cranking out a schema and validating everything as you go.

Re: Pkl, a Programming Language for Configuration

#343

This reminds me of the idea behind Lua - similarly the original users needed a configuration format which became increasingly sophisticated and at some point the authors realized they needed “proper” programminglanguage constructs.

This is also why Lua is called Lua, the original configuration language was called SOL, for Simple Object Language. It never shipped, by the time the desired code was delivered to Petrobras, it was the first edition of Lua.

The authors have a fun read[0] about the history of the language, for the curious.

[0]: https://www.lua.org/history.html

Re: Pkl, a Programming Language for Configuration

#344

Earlier quoted context omitted.

I’m also curious, because Graal is pretty exciting stuff, what this might give over Jsonnet or Cuelang. It’s already a hard enough sell to try to get people to adopt these and they are much older and more robust than Pkl.

I'm very wary of anything Java-based, having been burned by Java tooling in the past. I work on a few different Android projects and I have to switch between three different JDK versions depending on which I'm working on. What happened to "write once, run anywhere"?? I really like Pkl's comparison page, which includes its weak points as well! https://pkl-lang.org/main/current/introduction/comparison.ht... Pkl’s nativ…

[dead]

Re: Pkl, a Programming Language for Configuration

#345

Anything development related from Apple is inherently disinteresting unless it's aimed at Apple, is for Apple and you're building for Apple. Apple has done nothing cross platform or open source or community oriented so if they come out with something that's intended to be more general is has no base, no users, no audience of non-Apple developers to land on. I'm not anti Apple - I love MacOS and Apple is my main machi…

What's clang, chopped liver?

Re: Pkl, a Programming Language for Configuration

#346

This feels like a strict superset of hashicorp's HCL with strong typing and include statements. Once again, Apple has released a piece of tech which is innovative in its ergonomics perhaps, but ultimately a copy of a predecessor. This is becoming a habit of theirs and has only developed recently. Unpopular opinion: yaml is almost as close to perfection as can be gotten. The only thing we could do to make it better is…

I'd like you to consider that there's an approach to commenting on this kind of thing which wouldn't leave your contribution languishing, greyed-out, at the bottom of the thread.

See if you can figure out what that approach would be, and adopt it in future.

Re: Pkl, a Programming Language for Configuration

#347
post #318

I'm having a little trouble understanding the problem(s) Pkl is trying to solve. After reading the title, my assumption was that Pkl was yet another newer, better configuration language (a la TOML), but now that I've read the article, it sounds like it's more a language for _generating_ config. Unless I'm mistaken, it sounds like an abstraction on top of your config files meant to help you build & re-use configuratio…

It solves exactly the sort of problem you are describing, yes! I think the discussions here focus too much on the language bindings, but maybe I’m missing that point as well.

Re: Pkl, a Programming Language for Configuration

#348
post #338

Earlier quoted context omitted.

edn + clojure was the most pleasant configuration system I've worked with, but I have never convinced anybody else to use it. Jsonnet on the other hand, people get productive in it pretty quickly. It's my default choice for all configuration now.

I wonder, what would happen if Clojure was marketed as a configuration file format from the very start, without mentioning persistent immutable data structures, software transactional memory, and other scary words. Would it have more adoption now?

I doubt it; edn seemed like _that_ rebranding effort. It looked json-like enough, but clearly didn't have the draw. People who complain that json has no comments obviously have a secret list of other gripes.

The general tooling wasn't there, apart from clojure. I tried one of the edn libs for python/node and it always felt second class. The full power was just never there outside of clojure projects.

It's like how everybody still uses QWERTY (including me) and are happy to buy better keyboards, but they must still be in QWERTY

Re: Pkl, a Programming Language for Configuration

#349
post #181

I've had a good long think about configuration languages, and after a long-term on/off love/hate relationship with schemas I think I've finally concluded that I don't want rich types in my configs, thank you very much. I use statically-typed programming languages, and for my purposes I'd rather have a config language where the only types are strings, arrays, and hashmaps, and then push all type validation into the pa…

Guess the obvious question is why don’t you want types in your config language? Pushing all the validation to parsing state just makes it hard to write valid config, because you only know if the config is valid when you feed it into your program. Having the ability to pull all that validation forward, and into your IDE, means you can be told about invalid config as you’re writing it. To me the idea of only wanting to…

> Guess the obvious question is why don’t you want types in your config language?

Where do you store the schema?

Post reply on HN