Previously posted by one of the authors here - <a href="https://news.ycombinator.com/item?id=39232976">https://news.ycombinator.com/item?id=39232976</a>
Anyone has opinions on this versus "Dhall"?<p>Dhall seems to be explicitly total (non-turing complete) while Pkl seems to be Turing Complete, hence dangerous as you can basically compute anything
This looks promising! I like that the template file also defines constraints at compile time, and that there is codegen to make it easy to work with pkl files well-typed in a decent variety of languages.<p>The tutorial is also nicely written. Props to Apple for writing really good docs on this one! The error messages it produces also look pretty good.<p>It would be nice if they added compiled equivalents of each code snippet from the tutorial in other formats, though, since it wasn't immediately clear how certain types (like `duration: Duration = 30.min`) would be represented in JSON.<p>If anyone at Apple is reading this, another thing that would make it much easier to evaluate and decide whether to adopt pkl would be to include an online compiler with a few built-in examples so that anyone can quickly see how the configuration is transformed without delving into the full docs.
I wrote a config adapter for Caddy so you can write your Caddy configs with Pkl: <a href="https://github.com/caddyserver/pkl-adapter">https://github.com/caddyserver/pkl-adapter</a><p>The big gotcha is it's only implemented in Java. So any language bindings have to shell out to a subprocess to actually do any work.
This looks like a winner to me.<p>I haven't had a chance to use it yet, but it addresses some gaps in validation for JSON, YAML and other configuration files and I appreciate their approach to the problem. I look forward to using it the next time I have a system with JSON that's unwieldy.
> port: Int(this > 1000) = 80<p>Yeah that looks pretty useful.<p>In JavaScript land, I just do this with zod to crash the server on startup, but I can't remember if there's already an easy way to do it with the java/kotlin/gos
This has some pretty great ideas within it. A few that stuck out to me in case others don't want to skim the full spec:<p>Start with YAML/JSON/TOML, but then add:<p>- Optionally strict typing and structs<p>- Inheritance<p>- Dynamically computed properties<p>- Functions & object methods, which are really more like computer properties<p>- If/Else conditionals, which are really more like a ternary<p>.. and managed to do it while still making it look like a simple config file.<p>The closest analogue from memory might actually be Terraform.<p>The one thing that had me squinting was the object extension syntax. It looks powerful.. and I understand its value.. but wow that's ends up being eye-full of () {} and [] all in one code bock.