Live data from Hacker News

Pkl, a Programming Language for Configuration

pkl-lang.org

531–540 of 598 posts

Re: Pkl, a Programming Language for Configuration

#531
Honestly, I don't imagine this being a good idea. The problem it solves is pretty clear, and it's easy to see how one attains the desire to solve that, but is it really that kind of problem which should be solved?

It is kinda commonplace that you don't write configuration in the real PL. Maybe it's less obvious, when your working language is Go/Java, since they are compiled, so obviously you have no choice but to keep configuration in an interpreted format. But you also don't do that in Python/PHP/Javascript. You could just write configuration using full power of Python, right? But even when you do keep some configuration as Python code (because it's only developers who are tweaking these constants anyway, etc.), you usually prefer a plain dict for that, not a bunch of dynamically generated classes with multi-level inheritance.

So, ok, maybe it makes sense when you have to deal with a over-engineered fucked up third party tool like k8s, which you have to configure in YAML, and you could just make it less verbose and have some schema? Well, I don't know, maybe. But the point holds. The good thing about YAML/JSON/etc is that they are very declarative (even when they are used a as imperative DSL syntax, as in GitHub Actions or k8s). If you see that port = 6001, it's 6001, that's it. Your entire DB configuration is right there, in front of you.

The biggest selling point of PKL seems to be that "sidecars" example. And, I mean, sure, it's precisely the problem we intended to solve. But it also shows that you (oh, not you, but your co-worker, of course) could write pretty much anything. It doesn't look like a configuration anymore to me. It's exactly keeping your "configuration" in the source-code of your app, in a real PL, using dynamically generated classes in a cycle and whatever. The thing, we don't usually do for some reason.

Re: Pkl, a Programming Language for Configuration

#533

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.

[deleted]

Re: Pkl, a Programming Language for Configuration

#534

Earlier quoted context omitted.

Bazel is just the build system used to build Copybara. You don’t need to have Bazel in your system to use an already built copy of Copybara

Yes, but: > Copybara doesn't have a release process yet, so you need to compile from HEAD. Looks like there's an Arch Linux build maintained by... somebody, but if you're not on Arch then you're going to be building Copybara with Bazel. That this works for them suggests to me that their community has a significant amount of overlap with the Bazel community, so it's not good evidence of Starlark being used outside of…

(I've been the main designer of Starlark)

Lots of projects developed at Google use Starlark. Copybara is one of them. That's where the connection comes from.

Many other companies are also adopting Starlark for their own needs. For example, Meta has invested a lot in Starlark and published their implementation (https://developers.facebook.com/blog/post/2021/04/08/rust-st...), although they don't use Bazel at all.

Starlark was first created for Bazel. The organic user growth comes from people who have seen and used the language, so often Bazel users. But it doesn't have to be.

Re: Pkl, a Programming Language for Configuration

#535
post #71

I thought it odd that the language bindings didn't include the most popular langage, Python. In fact, Python seems not to be mentioned at all in the linked page. So I'm wondering, is it 1) Because the developers of Pkl are Python haters 2) Because the developers of Pkl are so overawed by Python that they can't imagine Pkl contributing anything useful to the Python ecosystem In either case, having suffered so much usi…

“Popular” doesn’t mean “fitting every purpose”. All the listed languages are compiled and statically typed. Python is neither. Neither is JavaScript, another popular programming language which is also not listed.

I don't see how the static typing of the bound languages enters into it. Python has type hints which can be enforced by some compilers, if you are so committed to type safety in your config scripts. If you have Pkl output YAML or XML then where is your type safety?

Since "popular" does mean that very many people are using it, I think it would be wise to try to serve the Python community.

Re: Pkl, a Programming Language for Configuration

#536

I thought it odd that the language bindings didn't include the most popular langage, Python. In fact, Python seems not to be mentioned at all in the linked page. So I'm wondering, is it 1) Because the developers of Pkl are Python haters 2) Because the developers of Pkl are so overawed by Python that they can't imagine Pkl contributing anything useful to the Python ecosystem In either case, having suffered so much usi…

> Because the developers of Pkl are Python haters Look at the languages that they do support - Go, Swift, Kotlin, Java. These are all robust languages for writing production grade software. That's probably why - the people at Apple using this don't need it for their hacky Python scripts.

By "production grade software" do you mean major sites like Instagram or Reddit?

Re: Pkl, a Programming Language for Configuration

#537

25 years ago pretty much every program had a GUI to do the configuration. With help texts. On Windows, programs then either saved stuff into an ini file or the windows registry, both you could also edit manually. Today we have a programming language coming as a 87 MB binary to create config files. And to run that programming language you need to manually crate a ... config file. So what we are missing now is a 500GB…

I'm convinced some developers are copying the lawyers old scam of charging by the word why else would we have this nonsense

Re: Pkl, a Programming Language for Configuration

#538

Earlier quoted context omitted.

> Better to learn a tiny corner of nix (which you may later apply to the rest of it, or not) than to learn a language with a narrower use case. "Better" in what way? Like, maybe I agree in some sort of philosophical sense, of how it's better to learn and expand one's awareness of what exists and is possible in the world. That is, better for students , similarly to how I'd say it is better for students to learn lisp a…

If you're: > a professional figuring out how to set up or refactor the config structure within the non-Nix paradigm of the vast majority of organizations Then I don't think nix-as-config-only is a good move. But if you're a professional figuring out how to set up or refactor the config structure of some organization, AND for some reason you've already decided that you're going to introduce a language that nobody in t…

> Then I don't think nix-as-config-only is a good move.

Yep, that was the only narrow point I was trying to make initially :)

> If a multitool's screwdriver is just as good as a normal screwdriver (granted they're usually not), why not prefer the multitool?

Under the assumption that the multitool's screwdriver is just as good, then yeah, that might make sense. But as you grant, that is usually not the case. And my original point is that this is one of those usual cases where it is not as good, not one of those rare cases where it is just as good. And the reason Nix is not just as good for this, is that it was not made for this, it was made for something different and bigger.

> For instance we have a lot of python in our stack so I've found a library called mergedict that gets us close enough to the composability of nix modules without adding a new language.

Things like mergedict, while being a common genre of solution to this problem, are not a good solution to it. They are the total mess I said I'm always keeping an eye out for better alternatives to.

I don't know yet if I think Pkl (or Cue or any of the rest) actually fit that bill, but your contention that there is no point looking for solutions to this problem short of Nix strikes me as a classic case of making perfect the enemy of good.

Re: Pkl, a Programming Language for Configuration

#539

Earlier quoted context omitted.

Kubernetes config is a decent example. I had ChatGPT generate a representative silly example -- the content doesn't matter so much as the structure: https://gist.github.com/cstrahan/528b00cd5c3a22e3d8f057bb1a7... Now consider 100s (if not 1000s) of such files. I haven't given Pkl an in depth look yet, but I can say that the Industry Standard™ of "simple YAML" + string substitution (with delicate, error prone indentat…

Maybe not always, but surely in most cases of too complex a config, it is a case of ad-hoc grown config, representing what one wants to actually configure badly, and/or underlying abstractions of the thing one wants to configure matching badly what one wants to do. In most cases it would be good to take a step back, or multiple ones at that, and really ask oneself: "What is it, that I actually want to configure here?…

Sure. There are undoubtedly a lot of config formats that are overly complex.

But sometimes the complexity is irreducible. Kubernetes is one such case. The model is very well thought out, and just about as simple as it could get without removing functionality. It has sensible defaults, built-in versioning, well-defined schema etc. But if you want to describe a complete installation of a distributed system with many heterogenous processes, spread across many hosts, communicating in specific ways, with specific permissions, persistence, isolation, automatic scaling, resilience, etc, there are a lot of details. I've worked with systems that have thousands of lines of configuration, and honestly that's not extraordinary. Many people on this site will rightly scoff and say, "psshh, that's nothing."

Configuration languages are a really important area of research in the tech industry right now, and every time someone posts one on here, there are a huge number of dismissive comments. Fine. Not everyone has this problem, but it's a real problem, and solving it represents a real advance in the state of the art.

Re: Pkl, a Programming Language for Configuration

#540

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…

> Apple has done nothing cross platform or open source or community oriented Cups - https://en.wikipedia.org/wiki/CUPS Swift - https://en.wikipedia.org/wiki/Swift_(programming_language) Zeroconf - https://en.wikipedia.org/wiki/Bonjour_(software) I think they're bad, opaque opensource maintainers, but they did release some popular things that have communities on other systems. I do wish they just contributed to nickel…

> I do wish they just contributed to nickel or something else though rather than doing their NIH as usual.

Did Nickel exist in 2018? (Someone here said that Pkl did.)

Post reply on HN