14 ms·
Pkl, a Programming Language for Configuration
- gede171 3y ago[flagged]
- dsheets 3y agoSpam. Please flag and remove.
- diimdeep 3y agolink to binary is 404 https://pkl-lang.org/main/current/pkl-cli/index.html#macos-executable https://pkl-lang.org/main/current/pkl-cli/index.html#macos-e...
- bioballer 3y agoPkl is a new language for describing configuration. It blends together the declarative nature of static formats like YAML or JSON, with the expressiveness, safety, and tooling of a general purpose programming language.
- kakaz 3y ago[dead]
- p10jkle 3y agoI used this extensively when I worked at Apple and LOVED it. So excited that its finally out
- btmiller 3y agoI was a big believer in Helm for generating Kubernetes resources until I looked up and saw that we had created an impossible-to-validate, impossible-to-reason-about DSL in our values.yaml and that's when I realized we were at the end of our rope with Helm. We switched to Pkl for our Kubernetes resource generation -- it's delightful to maintain and reason about our deployments before execution time :)
- wktmeow 3y agoThis is the use case I am most interested in as well, templating strings into yaml always felt super clunky to me.
- jowf8fa9sdf 3y agoAfter spending 5,000+ hours in helm charts, I still hate helm. I've looked at cdk8s but I hate the tsconfig culture, why can't it be simple like Go?
- shepherdjerred 3y agoTry Deno with CDK8s! It's such a fantastic experience. Here's a repo for my home server: https://github.com/shepherdjerred/servers/tree/main/cdk8s https://github.com/shepherdjerred/servers/tree/main/cdk8s
- e12e 3y agoCurious if you have experience with terraform/open tofu/hcl for k8s?
- jaseemabid 3y agoPkl was one of the best internal tools at Apple, and it’s so good to see it finally getting open sourced. My team migrated several kloc k8s configuration to pkl with great success. Internally we used to write alert definitions in pkl and it would generate configuration for 2 different monitoring tools, a pretty static documentation site and link it all together nicely. Would gladly recommend this to anyone and I’m excited to be able to use this again.
- filleokus 3y agoWas about to ask if you had k8s api models available internally, and that someone should create some tool to generate that from the spec. But turns out it already exists in the open! https://github.com/apple/pkl-k8s-examples https://github.com/apple/pkl-k8s-examples
- crabique 3y agoWhy yes, I would like to see more of those in my k8s, so glad we finally have the technology https://github.com/apple/pkl-k8s-examples/blob/96ba7d415a85cfbf5b6ef396ca4d1592e8451e02/pkl/advanced/deployments.pkl#L46-L55 https://github.com/apple/pkl-k8s-examples/blob/96ba7d415a85c...
- physicles 3y agoComing from yaml+kustomize, all those curly braces are a tough sell. It looks like they roughly double the number of lines in the file.
- fzeindl 3y agoWhile I learned to accept YAML it messes up editor usage. It is so sensitive that basic text editing like copy and paste, tab, in/decreasing indent never quite do what I expect in IntelliJ. I paste parts of yaml into another yaml and it ends up somewhere unpredictable.
- manmal 3y agoCurly braces are great at ensuring correctness though, as goto fail; has shown.
- lijok 3y agoSerious question - why not just use python?
- bioballer 3y agoPython isn't oriented around defining and validating data. For example, something like: "this number is be between 1 and 10" means you have to come up with a novel way to add validation, because it isn't built into the language. Also, Pkl is meant to be usable everywhere. General purpose languages tend to be tied to their own ecosystem--imagine telling a Go developer that they need to install Python, set up virtualenv, and run pip install so they can configure their application. We'd like Pkl to be a simple tool that can be brought anywhere, and easily integrated into any system.
- jowf8fa9sdf 3y agoThis made me realize that Go actually succeeds at being more pythonic than python. I'm also incredibly high.
- lijok 3y agoHigh or not, you're 100% correct. Have a look at PEP 20 – The Zen of Python. Python is actually horrible at following it, Go doing a much better job.
- lijok 3y ago> For example, something like: "this number is be between 1 and 10" means you have to come up with a novel way to add validation, because it isn't built into the language. No need for a novel mechanism - there are plenty of available solutions to add validation to python > imagine telling a Go developer that they need to install Python Pkl doesn't come preinstalled on machines - so you'll have to install it as well > set up virtualenv, and run pip install so they can configure their application This is the real friction point, but is it a bigger friction point than having to adopt yet another DSL?
- 3y ago
- JonChesterfield 3y agoTypes on the fields is interesting. The examples suggest said types are lost when you serialise to json or xml, though it seems like at least some types should be expressible as schemas. Language reference doesn't mention schemas either https://pkl-lang.org/main/current/language-reference/index.html https://pkl-lang.org/main/current/language-reference/index.h...
- mimischi 3y agoYou are looking for templates: https://pkl-lang.org/main/current/language-tutorial/02_filling_out_a_template.html#amending-templates https://pkl-lang.org/main/current/language-tutorial/02_filli... There’s another repo, the Pkl Pantry, that provides a couple of ready made templates (Schemas) that you can try out: https://github.com/apple/pkl-pantry https://github.com/apple/pkl-pantry
- JonChesterfield 3y agoI was looking for a translation from a pkl template into an xml schema. It would probably be lossy - I think pkl can express more invariants than xml or json schema can - but still gives some invariants on the data for use downstream of the pkl tooling.
- sms8069 3y ago[dead]
- jjirsa 3y agoCongrats Apple folks who worked on this, I know it’s been a long time coming
- HardlyMatters 3y agoI 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 using Ansible and its excrable YAML scripting, I may use Pkl together with Python.
- jen20 3y agoProbably secret option number 3 of no-one having needed it yet - because the tool is standalone, you can render the required output before running whatever needs to consume it. I’ve certainly used it from Python in that manner - bindings are only required if you want to consume the raw language programmatically from a Python context.
- mimischi 3y agoExactly this. Pkl is most useful as a type-safe configuration language that can output to any other format (already supported, or put together by the user within Pkl). You’ll always get valid JSON, YAML, PLIST, what-have-you as output. This you can then parse in the language/system of your choice. Certainly language bindings are useful, and if there’s demand likely someone will create them.
- Alifatisk 3y ago> 1) Because the developers of Pkl are Python haters Is it really that deep?
- latexr 3y ago“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.
- HardlyMatters 3y ago
- JSR_FDED 3y agoThis 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.
- samatman 3y agoThis 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 https://www.lua.org/history.html
- peefy 3y ago[dead]
- deleted 3y ago[deleted]
- vaporup 3y ago[dead]
- isodev 3y ago> Pkl — pronounced Pickle — is an embeddable configuration language which provides rich support for data templating and validation. It can be used from the command line, integrated in a build pipeline, or embedded in a program. Pkl scales from small to large, simple to complex, ad-hoc to repetitive configuration tasks. I do like the sound of that. It's always quite tedious to manage configuration in full-stack applications with mixed languages/ecosystems. It seems they already have Pkl plugins for IntelliJ, vscode and neovim and a language server is "coming soon".
- sevkih 3y agoCongratulations Phil!!
- deleted 3y ago[deleted]
- ubavic 3y agohttps://xkcd.com/927/ https://xkcd.com/927/
- eviks 3y agoIndeed, launching Chrome would simply increase the browser count by 1 (is there an xkcd for that?) https://cdn.statcdn.com/Infographic/images/normal/1438.jpeg https://cdn.statcdn.com/Infographic/images/normal/1438.jpeg
- DrNosferatu 3y agoSo Apple just invented NixOS?
- mirekrusin 3y agono you can click it, it'll open link in your browser where you can read what it refers to.
- otabdeveloper4 3y agoOnly the Nix language.
- hcarvalhoalves 3y agoNot to be confused with “pickle”, the Python object serialization format…
- amszmidt 3y agoOr GNU poke (https://www.gnu.org/software/poke/ https://www.gnu.org/software/poke/) source files which are called "pickles".
- devmor 3y agoOr PECL (pronounced Pickle), the old PHP package manager superseded by Composer.
- pimlottc 3y agoWhere "format" is used in the lightest way possible. (NEVER try to unpickle anything that was not produced by pickle itself (preferably the exact same version))
- causal 3y agoMy first thought too :(
- msoad 3y agoJSONSchema 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.
- iamflimflam1 3y agoEvery 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.
- bbkane 3y agoI 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
- Szpadel 3y agotrue, 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?
- baq 3y agoJsonschema 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.
- Alifatisk 3y agoSo this is like jsonnet, sdlang and cuelang? What does Pkl do different?
- scythmic_waves 3y agoDocs: https://pkl-lang.org/main/current/introduction/comparison.html#other-config-langs https://pkl-lang.org/main/current/introduction/comparison.ht... (Never used Pkl myself...)
- bobuk 3y agoit's very brave to release a new configuration language with no Python support today.
- isodev 3y agoThey start with Swift, Java, Kotlin and Go. That's already a big chunk of applications. Perhaps more will come in the future.
- w-m 3y agoAnd at the same time borrowing the name and file ending of Pythons object serialization protocol.
- The_Colonel 3y agoThat's a strange way to frame it, you don't have to support every language to be successful. World domination might not even be the project's goal.
- randomdata 3y agoPython is able to load Python code at runtime, so one can use Python for configuration. A solution doesn’t need to go looking for problems that are already solved.
- 3y ago
- HexDecOctBin 3y agoI'm sorry, can someone explain why one would want to translate from one data description language to another (Pkl -> JSON, or whatever)? Why not just write JSON (or whatever) to begin with?
- deleted 3y ago[deleted]
- avianlyric 3y agoBecause Pkl makes it trivial to write templates and transforms. So you can write a Pkl schema that only requires a minimum set of fields, then auto generate a complete configuration. This is most useful when dealing with tools like k8s where deploying a single application might involve 3-10 separate manifests (Deployment, Service, NetworkPolicy, HttpRoute, Autoscaler etc etc). With Pkl you can easily write a simple template that only requests the minimum needed to define an “app” (e.g. name, namespace, mixins for sidecars) and have Pkl generate all the needed manifests for you. Really Pkl should be seen as a language for quickly building templating tools like Helm. But with type safety by default, and no need for horrible indent hacks.
- pjerem 3y agoJust scroll a little further. It’s not just another syntax for config files.
- hiAndrewQuinn 3y agoWell, Dhall provides something between JSON and a Turing complete language that can make a lot of configuration much quicker to write, if you can hack the functional syntax. Pkl is probably a similar concept. http://dhall-lang.org/ http://dhall-lang.org/
- kccqzy 3y agoI love Dhall. It's purposefully not Turing complete (which is somewhat difficult to achieve in a language design) and I love that fact.
- isodev 3y ago
- andersrs 3y agoI like it. I wish Helm used objects instead of string templating. Hopefully it becomes a popular alternative.
- playingalong 3y agoIn what sense is this programmable? Can I write a loop in this? If? Elvis operator? A simple map lookup?
- avianlyric 3y ago> Can I write a loop in this? https://pkl-lang.org/main/current/language-reference/index.html#for-generators https://pkl-lang.org/main/current/language-reference/index.h... > If? https://pkl-lang.org/main/current/language-reference/index.html#if-expressions https://pkl-lang.org/main/current/language-reference/index.h... > Elvis operator? https://pkl-lang.org/main/current/language-reference/index.html#null-values https://pkl-lang.org/main/current/language-reference/index.h... > A simple map lookup? https://pkl-lang.org/main/current/language-reference/index.html#mappings https://pkl-lang.org/main/current/language-reference/index.h...
- mirekrusin 3y agoSo like cue [0] but more primitive, less principled and in java? [0] https://cuelang.org https://cuelang.org
- leblancfg 3y agoThat’s what I’m seeing as well. Curious to try it out to see how its expressiveness compares to Cue. Looks like it’s Turing-complete as opposed to Cue, which is a plus… but that comes with downsides. One thing I like to see is the direction of “declare types and validations in a single place, integrate with any language”. My daily codebase atm has types declarations in typescript, cue, pydantic and for our database… and it’s driving me bonkers seeing as most types are already declared in Cue to start with. I played a little with packages meant to translate them i.e. Cue -> TS, but nothing worth the effort. IMO it would be a big upside for Cue to handle these as first class language features.
- ratorx 3y agoWhat advantages does Turing-completeness provide for a configuration language?
- neongreen 3y agoThere are three (maybe more?) ways things can be Turing-incomplete: 1. You are limited to N evaluation/reduction steps. 2. The language doesn't include primitives like recursion or loops. 3. You can have recursion or loops, but the language makes you somehow prove that your program will terminate. I think (1) would be fine, but I don't know any configuration languages that use this approach. (2) is restrictive/annoying whenever you want to implement any logic in the config language library. Eg. a tool uses a homegrown data format BAML and you need to convert JSON to BAML in the config. Now either you have to write and manually call a preprocessor, or you need to use a patched version of the <config language evaluator> that will have JSON->BAML as a built-in, or you must implement JSON->BAML without loops or recursion. For a more realistic example, imagine that a certain config string has to be HTML-escaped and the config language doesn't provide a built-in for that purpose. (3) -- you don't want it. There are languages (like Agda) that let you prove things like "this program terminates", but writing those proofs can be harder than writing the program itself.
- andrewstuart 3y agoAnything 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 machine. I'm just pragmatic about Apple technologies - they are all for usage inside the Apple bubble.
- watersb 3y agoI think they funded development of Clang and LLVM.
- josephg 3y agoAnd WebKit, which is the rendering engine in Chrome. (Though Google now maintains their own fork).
- iainmerrick 3y agoAt first glance, this is interesting in that it’s the least Apple-ish open source project I can remember seeing. I can definitely see uses for it right now in non-Apple-ecosystem projects where you’re not already invested in a different tool.
- viraptor 3y ago> Apple has done nothing cross platform or open source or community oriented Cups - https://en.wikipedia.org/wiki/CUPS https://en.wikipedia.org/wiki/CUPS Swift - https://en.wikipedia.org/wiki/Swift_(programming_language) https://en.wikipedia.org/wiki/Swift_(programming_language) Zeroconf - https://en.wikipedia.org/wiki/Bonjour_(software) 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 or something else though rather than doing their NIH as usual.
- 3y ago
- sgt 3y agoLooks great. Reminds me a bit of HCL.
- lclarkmichalek 3y agoIn a competition with sky/starlark, I feel skylark would win here. “Safe subset of python” is what a lot of people presented with this problem want, and skylark gives them almost exactly that. OTOH, curious to see what advantages Pkl gains from not having the constraints of maintaining familiarity with another language.
- mieubrisse 3y agoAgree - one of the things we've found using Starlark at Kurtosis is even the small jump from Python to Starlark makes people think, "What's this Starlark? I don't want to learn a new language", and we have to show them how not-a-new-language it is. I can't imagine bringing a truly new language like Pkl to folks and having them enjoy it.
- chefandy 3y agoI thought the same thing with the Godot game engine's GDScript. Aside from a few class-level implementation details (IIRC, it's been a while) it's essentially Python, syntactically. "Ugh... If I'm going to learn a new scripting language it's not going to be application-specific... Oh NM."
- lolinder 3y agoStarlark seems to be overwhelmingly bound to Bazel at the moment—searching for it, I had to follow a link from Bazel to the GitHub repo and then from there I got to the implementations and found this: > The implementations below are not fully compliant to the specification yet. We aim to remove the differences and provide a common test suite. This does not inspire confidence that I could use this in a project any time soon. Meanwhile, from what I can tell Pkl has a single Truffle implementation that currently supports 4 languages, it has a syntax that is more familiar to me as a non-Python dev, it has static typing, and it has a dedicated plugin in most IDEs (whereas Starlark just says to install the Bazel plugin). Maybe Starlark is more appealing to people writing Python or already using Bazel, but for the rest of us there's no contest right now.
- 3y ago
- OJFord 3y ago> We offer plugins and extensions for IntelliJ, Visual Studio Code and Neovim, with Language Server Protocol support coming soon. Why? Why would they not have just done the language server first (or only)? All of those have built-in support for it, so separate implementations wouldn't have been necessary; that's the point. I just don't understand why you'd make that decision on a greenfield project today, especially if LSP support is planned at all?
- snom380 3y agoWhy assume it's a greenfield project? I would think most open source software that comes out of companies have lived internally for a while before going public?
- OJFord 3y agoFair point.
- rcarmo 3y agoThis. I’m willing to bet I talked to one of the people who use this internally at Apple a few years back when I interviewed there (before they decided to do away with remote hires). They didn’t mention it, but it fits the context.
- p10jkle 3y agoYes, I was using it when I joined Apple in mid 2020
- eviks 3y agoDoes this support fancy symbols in bare identifiers? Even the huge reference page is blank on that, and the only working links to grammar are to the ANTLR website, but even if they did work, the grammar is also blank as it simply references an internal grammar function And there doesn't seem to be any online playground to test
- jen20 3y agoYes: quoted identifiers are represented using backticks (which do not then form part of the name), so: local `My Variable` = 42 Do you happen to have a link to the missing/blank reference page on this? EDIT: perhaps I misunderstood the question - if it's about whether you can use non-ASCII characters in identifiers without quoting, the answer is "sometimes": ``` local `abde` = 42 // Only works when quoted local `teʝ` = 42 // Works fine (as expected) local teʝ2 = 42. // Also works fine ``` It might be interesting to expand the docs to cover the precise rules here without having to resort to ANTLR grammar, as you say.
- eviks 3y agoYes, I meant bare unquoted identifiers For example, does x² = 42 work? Or move↓?=true or some emoji I guess not given your first example (though it's not rendered here properly, looks like 4 ascii letters), which is rather unfortunate as configs could be more readable with symbolic names, https://pkl-lang.org/main/current/language-reference/index.html#grammar-definition https://pkl-lang.org/main/current/language-reference/index.h..., both links are broken. Another thing is that the doc page should have an additional pages with a single section/page view otherwise it's too hard to find a word in a single huge doc
- grashalm 3y agoPkl was built using the GraalVM Truffle framework. So it supports runtime compilation using Futamura Projections. We have been working with Apple on this for a while, and I am quite happy that we can finally read the sources! https://github.com/oracle/graal/tree/master/truffle https://github.com/oracle/graal/tree/master/truffle Disclaimer: graalvm dev here. Edit: typo
- deleted 3y ago[deleted]
- simonfxr 3y agoI guess you mean Futamura projections?
- lionkor 3y agoI wish people named more tech products after popular media instead of common words. Would make it equally hard to web search, but at least it would be funny for non-techies to listen to
- notso411 3y ago[dead]
- deleted 3y ago[deleted]
- nindalf 3y agoYou'll really like the Quantum Resistant key exchange algorithm - Kyber. A related project is Cryptographic Suite for Algebraic Lattices or CRYSTALS. Sadly they renamed Kyber to MLKEM.
- MarkSweep 3y agoThere is also Dilithium: https://pq-crystals.org/ https://pq-crystals.org/
- leoh 3y agoFrom the folks that brought you plist, introducing yet another format, pkl!
- reactordev 3y agoIs this a joke? Why? We have so many usable formats already. Every language can do JSON. What problem does this solve? Or is this another Apple solution to a problem that doesn't exist?
- devmor 3y agoI do not find this particularly interesting because the problem has been solved by several projects already, but this is a programmable configuration file. i.e. you can write code statements and it transpiles down to other formats
- p10jkle 3y agoI'm not sure I'd agree its solved already, yes we have some languages (Dhall or Cue probably lead the pack) but I hugely prefer Pcl's syntax and approach. It's like saying that C solved systems languages, so there's no reason to have Go or Rust
- bladehaze 3y agoI kinda think we haven't solved this yet. Sure, this essentially is to generate a text file from another text file of parameters and code, which becomes our new configuration file. Then there is need to generate that new configuration file as things getting complicated. The current approach (of all these current languages, pkl looks like is the same) is to painfully refactor the ones you want to change to a parameter file, i.e. a manual data/code separation and you template that. It would be nice just say this configuration file is now a template file with A B C fields as parameters, and load it up in our new configuration file for templating with good trackability and performance. It is also easy to migrate to other languages, as configuration now can turn into code cheaply.
- shuafajdn 3y ago[dead]
- ChrisLTD 3y agoNo mention of Xcode support that I can find.
- steve1977 3y agoNoticed that as well... I guess not even Apple wants to use it anymore, oh my...
- rcarmo 3y agoThe services teams at Apple are more agnostic than what you’d think.
- steve1977 3y agoIn the not-eating-our-own-dogfood sense?
- jonhohle 3y agoIt’s not as if Apple provides server side tooling anymore. Though, even if they weren’t going to provide a server OS, it seems like they could still offer IDE support for the droves of web devs working on Macs a deploying to Linux (like I assume their devs do).
- rwarfield 3y agoSo how does Pkl compare to Nix or Dhall?
- xyst 3y agoWhat I like: - the validation system - ability to split large configuration files into smaller files and enhance readability (I know Java / Spring Boot apps already have this ability using profiles) - multiple language support Wonder if it’s possible to have more complicated validation functions. The example given validates 1 configuration (“port must be greater than 1000”). But there are times when some configuration is valid by itself however in the presence of other configuration the configuration(s) will possibly be ignored. Given: - configA - configB supersedes configA in app When: - both configA and configB set in pkl Then: - at compile time, should throw a validation error Criticisms: - documentation (in typical Apple fashion) appears to be lacking. Couldn’t find anything on the validation system - missing LSP support - yet another config language to support/learn
- mxey 3y agothe validation you are asking for sounds like what CUE does. If you say a: 5 a: 3 That’s an error. If you want the ability to "override", you have to write it like this, for example: a: *5 | int a: 3 This also works for struct/list members, so you can set defaults for all fields, and stuff like that. https://cuelang.org/docs/about/ https://cuelang.org/docs/about/
- pzo 3y agodoubt I would use it elsewhere instead of JSON but if this is an indicator that .plist in xcode will go away then I'm all in - .plist is probably one of the worst formats human can work with.
- jonhohle 3y agoNeXT used a text format for Plist[0] (which Amazon’s Brazil Config looked very similar to) but was deprecated relatively early in OS X’s lifetime. All of the plutils can still read it, but none of them will write it. The biggest drawback was limited number of types, imho. It seems like encoding issues were another drawback which led Apple to use XML when OS X launched. JSON want a thing yet, so XML probably looked like a good option. 0 - https://code.google.com/archive/p/networkpx/wikis/PlistSpec.wiki https://code.google.com/archive/p/networkpx/wikis/PlistSpec....
- p10jkle 3y agoIf you're interested, there's now an unofficial community Discord: https://discord.gg/vDhhCT24 https://discord.gg/vDhhCT24
- germandiago 3y agoWhat is the use case for this? There are a zillion config languages from toml to yaml to HCL.
- makach 3y agoprogrammable and safe is an oxymoron.
- indrora 3y agoFail to see how this is any different than Dhall (https://dhall-lang.org/ https://dhall-lang.org/) other than it produces plists too.
- neongreen 3y agoMy understanding is that it doesn’t require termination (“is Turing complete”), unlike Dhall.
- bongripper 3y ago[dead]
- 38 3y agosadly the Go implementation is bloated as hell: https://github.com/apple/pkl-go/blob/main/go.sum https://github.com/apple/pkl-go/blob/main/go.sum no thank you.
- aerfio 3y agoYou should rather look at go.mod file, and it doesn't look bloated at all. They could maybe drop cobra and use something with less dependencies, they use pflag package already so maybse use only that, but uhh I've seen much, much worse worse, as a daily Go user I'd say it's fine
- 38 3y ago> You should rather look at go.mod file no. the whole point of go.sum is to see everything. you could have a go.mod with a single item, but if that item is a giant module with hundreds of third party imports (as in this case), its quite misleading. > I've seen much, much worse worse, as a daily Go user I'd say it's fine uh where? I am a daily Go user, both professional and personal. and this is one of the most bloated modules I have ever seen.
- deno 3y agoBetter link: https://pkl-lang.org/blog/introducing-pkl.html https://pkl-lang.org/blog/introducing-pkl.html
- havaker 3y agoBuilt-in fetching of http resources and reading files from the filesystem[1] combined with turing-completeness are features that I wasn't expecting from a configuration language. I wonder if the complexity this brings is justified. 1: https://pkl-lang.org/main/current/language-reference/index.html#resources https://pkl-lang.org/main/current/language-reference/index.h...
- p10jkle 3y agoFor me, that's where all the power of the language comes from. It's like writing your config in Go or Python (which I think is also a great approach) except its designed from the ground up for this use case of config generation.
- rockwotj 3y agoAh just give me typescript, I do not need to learn a new thing for configuration languages and at the end of the day the output is compatible with JSON. Typescript has all the stuff I would want: types, first class json support, an ecosystem of libraries (if you want it, I would probably not for config generation). And the tooling is amazing. Does pkl have LSP, syntax highlighting in every editor, debugger or repl?
- jwoq9118 3y agoAgreed. If we're getting the point where you're saying "it's like writing your configuration in [insert Domain Specific Language Here]" then I'd prefer to simply use that language. I understand the point Pkl is making in that "configuration won't work across DSLs so here's one language for all of them" but I don't know that that's enough motivation for people to adopt it. However, I haven't built anything cool like this so what do I know. I'm just procrastinating on the my personal project and browsing hacker news.
- mekster 3y agoAt one time I just gave up on using any config formats and instead went back to the good old simple "use the programming language as the config file too" approach. It's certainly not cross language capable but when your editor knows exactly what's there and what's not with auto completion from the config file, that was a superior experience than caring about cross language issues that may not even be a problem depending on the project. If you must, you can easily make an identical copy of the config in the build process to convert it to another language.
- zevv 3y agoInterestingly, this is exactly the reason the Lua langue was conceived more than 30 years ago.
- leonheld 3y agoAre you sure about that? Pkl generates configuration from code. Lua was developed for a couple projects at Petrobras that were used for data entry and data flow. Maybe I don't understand the use-case for Pkl properly.
- Anduia 3y agoWhat does Pkl stand for?
- krzychh 3y agoso we're reinventing lisp yet again?
- sph 3y agoI have been looking into alternatives to YAML templating, the Helm abomination, etc. and was utterly surprised how no one ever apparently has thought to create a configuration/templating system that's basically a fancy library on top of Scheme. I truly believe every company is still reinventing the wheel because of a lack of serious foundational knowledge in most engineers, so they are doomed to recreate subpar, shitty alternatives.
- baq 3y agoYeah was thinking about that a lot, too. I guess there’s zero overlap between schemers/lispers and people doing yaml configs.
- eep_social 3y agoThere are dozens of us! More seriously, I don’t understand how anyone tolerates 5k line yaml files but I haven’t found any support for moving away from it at $bigcorp. Right now we use an undocumented shim layer between Helm and Argo for maximum inscrutable templating. It’s an endless footgun with the impact spread so thin it’s invisible to the business.
- vaylian 3y ago> was utterly surprised how no one ever apparently has thought to create a configuration/templating system that's basically a fancy library on top of Scheme. There's Clojure's extensible data notation: https://github.com/edn-format/edn https://github.com/edn-format/edn
- whacked_new 3y agoedn + 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.
- usrusr 3y agoHaving read through the the docs a little, my gut reaction is that they might be a little too much in love with the idea of having created a language that can serve both as schema definition and as minimal values carrier. It smells of unexpected failure modes through overuse [1]. But perhaps this is exactly the core feature: everybody who adds pkl to their software implicitly signs up for participation in whatever configuration monstrosity the downstream stack will end up having. Based on the assumption that that it will be a monstrosity anyways, and that a uniform system would be less bad than an unstructured mess. Next stage of concerns: if it's a heterogeneous stack that shares one configuration graph, the runtime implementation that is linked into parts of the stack can't ever be allowed to evolve. Ouch. And then there's runtime performance, I wonder if that could eventually become a factor, e.g. if short-lived go processes are involved? It all seems surprisingly ambitious, very far from the "why not json-with-comments" that was my first reaction (shared with many I assume) [1] digression: e.g. it reminds me of how in the dark days of peak XML java, a lot of typechecking was effectively thrown overboard because for some unfathomable reason everybody agreed that it would be nice to rearrange objects without a helpful compiler in the room
- garethrowlands 3y agoIt's normal for a programming language to have the ability to define types and create values of those types. Pkl is entirely conventional here.
- kibwen 3y agoI'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 parsing stage.
- acuozzo 3y agoReduce it further: strings and maps. Arrays can be represented as a map.
- ricardobeat 3y agoStrings can be represented as arrays too. Doesnt make a good argument for removing them.
- acuozzo 3y agoDoing so would necessitate the addition of another type: character/grapheme cluster. Representing arrays as maps would impose no additional requirements outside of validation which is already considered as part of the proposal in question.
- giancarlostoro 3y agoThe only thing I want is very basic flow control / environment based code blocks and that’s it. I think nginx has a reasonable config language
- ajross 3y agoThat's my feeling too. Tools like this are trying to squeeze into the space between "straightforward configuration easily maintained in static files" and "complicated state management better served by real code in a real programming language". And that's a real hole for some applications, but it's a small hole. Basically forcing everyone to learn new tooling (Pkl here, but lots of json/yaml middleware nonsense fits the bill too) just to deal with what really isn't that big of a problem seems like a bad trade.
- SushiHippie 3y agoCan somebody tell me real use cases they would use this for? I've seen their usecase documentation entry. And I understand the benefits this could have. But I think I need some hands-on usecases, to fully grasp why or how I would use this. Thanks
- jjirsa 3y agoRegrettably the folks who have been using it for years aren’t going to be give a lot of specifics, but generation of k8s yaml / jsonnet in particular was exceptionally common. One example from the other thread: > My team migrated several kloc k8s configuration to pkl with great success. Internally we used to write alert definitions in pkl and it would generate configuration for 2 different monitoring tools, a pretty static documentation site and link it all together nicely. https://news.ycombinator.com/item?id=39235425 https://news.ycombinator.com/item?id=39235425
- nsagent 3y agoCan't speak to Pkl, but for Jsonnet I made it possible to fully define then load neural network model architectures directly from Jsonnet config files [1], rather than relying on Python's unsafe pickle module. Since neural networks often have many repeating features, using a traditional configuration language requires repeating the same structures a lot, whereas using Jsonnet you can use `std.repeat` instead. You can see some examples of this in the readme of my package. [1]: https://pypi.org/project/cresset/ https://pypi.org/project/cresset/
- deleted 3y ago[deleted]
- gugagore 3y agoThe first thing the page shows is generating configurations in existing formats like YAML. For most of my use cases, there is tooling that does some updates of the configuration (e.g. bumping dependencies), so I'd really need bidirectional support to convert the updates back into Pkl.
- NewJazz 3y agoNot sure about Pkl, but Jsonnet will let you import a plain json file.
- somewhereoutth 3y agoPutting constraints into the config file is nice from a self documenting point of view, but I suspect that a) nobody will bother b) that one time they do, the constraint will be wrong in some circumstance, and the constraint will get edited out anyway.
- cduzz 3y agoIs this a reasonable tool to manage problems like: I've got a stream of json in one schema; I want to make ETL for this to write it out to elasticsearch, S3 (in a specific different schema) and postgres targets, using a mixture of "bespoke python", vector, and logstash. Should I use this or should I roll my own goo using ERB or mustache or similar? Or should I quit and go work some place that's using gRPC?
- cduzz 3y agoMore poking around in this; it'd be great if things like https://github.com/apple/pkl-pantry https://github.com/apple/pkl-pantry Had more documentation. Like there's a prometheus template; is that for use only in k8?
- deleted 3y ago[deleted]
- voidmain0001 3y agoPkl, pronounced like pickle? Pickle in Python https://docs.python.org/3/library/pickle.html https://docs.python.org/3/library/pickle.html Tcl pronounced tickle. https://www.tcl.tk/ https://www.tcl.tk/ PCL, was it ever pronounced pickle? https://en.m.wikipedia.org/wiki/Printer_Command_Language https://en.m.wikipedia.org/wiki/Printer_Command_Language
- FLT8 3y agoI was wondering whether anyone would point out the Python pickle, which is often used for saving trained ML models in .pkl files. I mean, at this point almost every memorable 3 letter file extension probably already has some claim to it, but still, it would have been nice if Apple had done some research and made this more unique.
- tedchs 3y agoThis page has helpful comparisons: https://pkl-lang.org/main/current/introduction/comparison.html https://pkl-lang.org/main/current/introduction/comparison.ht...
- g4zj 3y agoI manage and distribute my configuration files with Ansible, using the Jinja2 templating language. My needs are rather basic. I'm not sure if I'd benefit much from adding a tool like this to my workflow.
- Pesthuf 3y agoIt looks excellent and addresses all the issues I have with json, yaml, XML and co, but developers love to use "simple" technologies that then cause unending pain later due to being too simple. So I wonder if this will see much use.
- stevefan1999 3y agoToo bad, it doesn't have dotnet and C# support...
- EasyMark 3y agoWhy does everyone use these weird languages and not compromise and use some cut down version of python or lua as a DSL?
- djha-skin 3y agoThis 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 remove features. They got some things really right. Targeting dynamic languages over static ones is the right choice, though a difficult one. 64-bit floats written in decimal notation are the goodest lowest common denominator we have (sorry), and the ability to embed valid documents in other documents (multiline strings prefixed only with white space) is a game changer. JSON compatibility is controversial, but ultimately very useful. There are problems that are caused by too many features. The Norway problem is caused by too many features. References and splices are cool but generally confusing. That people do not use tags on their data 99% of the time in the wild strongly suggests that strongly typed configuration is less useful. True, there are too many different kinds of multi-line strings. Finally, if yaml were syntactically specified while preserving that white space feel, we could edit large yaml documents without having to get out our carpenter squares to figure out what level of indentation we're on. Syntactic specification will help our editors figure out what is happening while we type. I have addressed many of these problems in a new language called NRDL while seeking to preserve the things that yaml got right[1]. I feel we should learn from the mistakes and the success of those configuration languages that came before. 1: https://git.sr.ht/~skin/nrdl https://git.sr.ht/~skin/nrdl
- samatman 3y agoI'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 3y ago[deleted]
- dang 3y agoSee also https://pkl-lang.org/index.html https://pkl-lang.org/index.html (via https://news.ycombinator.com/item?id=39239265 https://news.ycombinator.com/item?id=39239265, but we merged that thread hither)
- mimischi 3y agoDid all the timestamps get reset? Seeing most (all?) comments at about 30min ago
- dang 3y agoAh sorry - that was an unintended side-effect of re-upping the original submission. I must have done some of the steps in the wrong order.
- notso411 3y agoYou mean you don’t have a distributed merge post microservice that emits post migration events, which are then consumed by a post owner conversion service using your existing event-driven architecture to facilitate seamless data synchronization and user notification processes??? That is not very hacker news of you from the guy who owns hacker news.
- deleted 3y ago[deleted]
- freedomben 3y agoI know you're joking, but I actually think complexity like that (when mostly unnecessary) is the least hackery thing in the world. Simple and effective gives me a hacker buzz
- notso411 3y ago[dead]
- sssilver 3y agoThe problem with configuration is that it’s only marginally useful to statically enforce that “this should be an IP address” or “this should be a port” People rarely waste time because they put a number where they should have put an IP address. People waste a lot of time because they don’t know what IP address to put in there. Look at any real life production nginx or kubernetes config and ask yourself an honest question — how much would a static type system actually help me in writing this config? We understand what types the configuration fields want — that’s trivial. We spend all of our time finding the correct values for those types.
- 29athrowaway 3y agoI can see that Apple is behind this. This looks better than Cue
- teleforce 3y agoHonest question, how this is better than CUE apart from its Turing completeness? But that probably not a feature that we really want in a config language?
- aemonfly 3y agoany plan to support c/cpp ?
- xorcist 3y agoWhat happened to generating config from templates? Like puppet/chef/ansible? Then it doesn't much matter what configuration format is used, as it is all generated from a common template. Systems like pkl and skylark live on their own and isn't well integrated with systems outside it (for example, an object inside a configuration might want to generate a log source definition in the central logstash config, or a new object in the monitoring system).
- Too 3y agoString templates are not type safe and they are super easy to mess up data escaping, by not closing a quote or even worse: deal with yaml indentation. Integration with resource creation shouldn’t be needed. If you look at terraform it actually does so and it’s surely nice, but that’s not strictly necessary, it’s just a result of terraform resources themselves being configured in the same configuration language as you write your config file templates. Supporting everything also comes with compromises, like only having a half-assed understanding of how to deploy Kubernetes manifests, instead of focusing on the job of only generating them.
- tommiegannert 3y ago> datasize3 = 5.mb // megabytes > duration3 = 5.ms // milliseconds grumpy sounds
- wslh 3y agoGenuine question: it is weird to find an Apple open source project that depends on Java. Is this because internally Apple has not break the historical link with WebObjects? [1] [1] https://en.wikipedia.org/wiki/WebObjects https://en.wikipedia.org/wiki/WebObjects
- nickm12 3y agoI'm curious about the language "bindings" for reading Pkl from Java, Kotlin, Swift, and Golang. At first I thought these were completely independent implementations of the language, since they read from Pkl source and not some intermediate format. However, the CLI talks talk about a "pkl server" mode that is used by the bindings. So it looks like there is a single implementation (written in some JVM language?) that is run in a subprocess. I wish there was more documentation about how this works under the covers. https://pkl-lang.org/main/current/pkl-cli/index.html#installation https://pkl-lang.org/main/current/pkl-cli/index.html#install...
- bioballer 3y agoAt some point, we'll publish more documentation about this, including instructions for how to build your own language binding. And, it's only a sub-process right now, but we plan on also providing a C library as another way to bind to Pkl. But if you want to learn more about how this works, feel free to connect with us on GitHub! https://github.com/apple/pkl/discussions https://github.com/apple/pkl/discussions
- deleted 3y ago[deleted]
- ploppyploppy 3y agoIt's written in Java. Jesus.
- chriscappuccio 3y agowhat a waste of time.
- gervwyk 3y agoI'm really enjoying reading through the docs and the tutorial. We've created Lowdefy, a config web-stack which makes it really simple to build quite advanced web apps. We're writing everything in YAML, but it has it's limitations, specifically when doing config type checking and IDE extensions that go beyond just YAML. I've been looking for a way to have typed objects in the config to do config suggestions and type checking.. PKL looks like it can do this for us. And with the JSON output we might even be able to get there with minimal effort. Is there anyone here with some PKL experience that would be willing to answer some technical questions re the use of PKL for more advanced, nested config? See Lowdefy: https://lowdefy.com/ https://lowdefy.com/ https://github.com/lowdefy/lowdefy https://github.com/lowdefy/lowdefy
- omoikane 3y agoIt seems like a truncated Pkl file can still be a syntactically valid file? This is a problem with TOML and YAML (but not JSON) where the language itself doesn't protect against truncations, and applications will need to add end-of-file markers or something similar in their config schema. I am not sure if Pkl has some built-in feature related to this sort of thing.
- rurban 3y agoThat's a feature, not a bug. Truncated files should not be accepted as valid
- TwentyPosts 3y agoSo you agree with them that it's a problem...?
- smusamashah 3y agoIsn't this similar to gradle (which is based on groovy lang)? Syntax and functionality looks similar.
- H12 3y agoI'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 configuration in a more standardized way, rather than yet another config language into itself. A problem space I'm familiar with is having a bunch of Terraform or Cloudformation configuration you want to share/repeat in multiple projects. Doing-so can get hairy quickly, as the path of least resistance is to copy-paste a bunch of config you barely understand from some other project, and then perform trial-and-error surgery to find and change a couple of lines to suit your project. Is Pkl designed to help address that sort of problem? Or am I missing something?
- mimischi 3y agoIt 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.
- bioballer 3y ago> A problem space I'm familiar with is having a bunch of Terraform or Cloudformation configuration you want to share/repeat in multiple projects. Doing-so can get hairy quickly, as the path of least resistance is to copy-paste a bunch of config you barely understand from some other project, and then perform trial-and-error surgery to find and change a couple of lines to suit your project. Yes, Pkl is meant to solve this problem. It's a single place for you to configure all your targets. Within the same codebase, you can generate static configuration, and also import the same Pkl source files into a runtime application, so you don't have to copy/paste things around.
- H12 3y agoThank you so much for the explanation! I see much more clearly how something like this could be extremely useful.
- 3y ago
- no_wizard 3y agoI appreciate what the language is trying to do and simplified configuration that is repeatable / re-usable is the goal. However I can’t help but wonder why systems don’t simply start adopting full programming languages once they hit a certain complexity. Having to use another language just to reproduce YAMl or what have you in a repeatable fashion is a symptom of the problem IMO
- p10jkle 3y agoThis is a full programming language! It’s just designed for exactly this goal.
- no_wizard 3y agoYes that I realize if I didn’t make it clear. I am definitely lamenting the fact that SDKs (CDKs?) aren’t already exposed in most common languages as a way to take advantage of the robust features of full programming languages. They either aren’t at all or they use some hybrid format (terraform etc) or they’re Byzantine in nature or ignore good API conventions
- rednafi 3y agoI like the syntax and the type system but it’s written in Java, why?
- whacked_new 3y agoI 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.
- amai 3y agoReminds me a bit of cfengine: https://docs.cfengine.com/docs/3.23/examples-example-snippets-general.html https://docs.cfengine.com/docs/3.23/examples-example-snippet...
- ironmanszombie 3y agoThis is awesome and extremely benefetial in this AI era. But the paranoid part of my brain doesn't like that.
- sgammon 3y agoThis is so cool! And built with GraalVM, too. Amazing
- sturlabragason 3y agoReminds me of [HCL](https://github.com/hashicorp/hcl https://github.com/hashicorp/hcl), but without all the providers to deploy the config?
- imhoguy 3y agoI feel I have seen it all already. Imperative DSLs created out of XML+XSD or <put-any-declarative-config-with-schema-here> fears which become exploited by expressiveness and nightmares to maintain after a while. This is why I still prefer Maven (XML) instead of Gradle (Groovy DSL) for Java project configurations. And the definitive question: can pkl configure pkl?
- eclectic29 3y agoIt's 2024 and the software industry has not solved the problem of configuration yet. Umpteen solutions every year - languages, formats, etc - all for just doing configuration. Just wow! It amazes me. It would be so much better if all the great minds focused on real issues than keep spinning on the hamster wheel of config file formats. Just look at the # of comments here.
- prophesi 3y agoComing from Elixir land, the Config module accomplishes some of Pkl's goals. But you're pretty limited by what you can do since the config files run at compile-time. Lack of typing and need for magic atoms to retrieve them can make them fickle and prone to typos. There's probably enough interest and demand for node bindings to be spearheaded. God knows how many config files you have to tinker around with in SPA land. And of course using it for docker/k8 configs could benefit just about any language.
- Fischgericht 3y ago25 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 framework that can write the config file for the programming language that is writing a config file for the actual program I wish to use. I am sorry, but very clearly a huge chunk of today's "developers" really are in the business of creating problems.
- afavour 3y agoThat strikes me as a very uncurious perspective. There’s absolutely nothing that could be improved about configuration files? An 87MB binary feels like a very arbitrary measure of worthiness.
- Aeolun 3y agoI mean, there is something to be said against using the equivalent of 87 novels worth of text to produce a note’s worth of configuration.
- Fischgericht 3y agoONE actual standard that everyone uses would be fine. For non-tree (nested) configurations, an ini file would do. It's a standard that worked well in 1990, and still does today. For nested data, it doesn't matter to me if it's JSON, YAML, TOML or whatever. Just agree on ONE format. TOML also is a good example of "creating problems instead of solutions": They deliberately (!) broke compatibility to the INI format due to "I can't stand unquoted strings". Yeah, emotional feelings about CONFIG FILE FORMATS. And again: If your config files are so complex, how about just creating a TUI/GUI so the user can configure your program in an accessible fashion? Anyway, yes, there is something that can be improved: Create a standard instead of adding another layer of complexity for something that should be very simple in the first place. Yes, binary size may feel arbitrary, but it often gives a hint about the hammer's size.
- biggio 3y agoffs
- timsuchanek 3y agoI like the syntactic sugar of directly validating types through modules. However, configuration at some point always converges towards Turing completness. I’m biased but imo nothing beats TypeScript and schema validation tooling like Effect.Schema or Zod. Yes it’s more code to write but you’re not locked in and can adopt the system as needed.
- taywrobel 3y agoWow, I was at Apple back in the 2018 timeframe when Peter was first building this. He was hoping to make it open sourced even back then, 6ish years ago. Great to see that it finally made it. I really wish Apple would learn to play nicer with the OSS community. I have yet to see them deciding to open-source something backfire on them monetarily or reputationally, and I've seen the act of them abruptly close-sourcing things sour community opinion (i.e. FoundationDB).
- bioballer 3y agoHey, I recognize this name :D Yeah, it's been a long time coming, and it feels great to finally get this out in open source. FDB is open source too, BTW: https://github.com/apple/foundationdb https://github.com/apple/foundationdb
- kistanod 3y agoMy team at Apple is very heavy on pcl + k8s configs. It's a very useful tool. Definitely recommend everyone to get familiar with it.
- Aeolun 3y agoI kind of feel that if your base is kubernetes (and especially helm) YAML soup, basically everything looks like a good alternative.
- leopard777 3y agoWhat about Lua?
- wslh 3y agoIt is a stretch to say that s-expressions could be added to the list of configurations/specification languages? [1] they can also be simplified to use less parenthesis. [1] https://www.gnupg.org/documentation/manuals/gcrypt/S_002dexpressions.html https://www.gnupg.org/documentation/manuals/gcrypt/S_002dexp...
- deleted 3y ago[deleted]
- Too 3y agoHow does this compare to HCL (Terraform)? It has about exactly the same feature set. Declarative config, type definitions, data validators, reusable modules, variables, transforming functions, loops and other repeat primitives, reading external data like files and envvars, output and input json or yaml, IDE integration, you name it. Much under-appreciated language btw. I hardly see it used outside TF. Here I think Pkl has an advantage of gaining adoption in applications, by generating types for the application code. Otherwise it will just stay as mystic item in the admins toolbox that others consider overkill.
- yakaccount4 3y agoWhen is the Swift rewrite?
- shanth 3y agoNix support?
- zamubafoo 3y agoUntil Cue/Pkl/whatever the current FotM has FFI that can be realistically utilized from most other languages (ie. not require custom bindings), it won't get real adoption. Without wide adoption, it's at best an interesting research project. A really cool project I want to work with, but not something I can reasonably bring up.
- jeremywerner 3y agoCongrats Peter!
- asimpletune 3y agoLet us review the progress we've had so far in this area * XML has the advantage of being almost perfect except its too verbose and isn't JSON * JSON has the advantage of being JSON, but is strangely broken at even basic stuff (i.e. comments, no trailing commas) * TOML has the advantage of being "better JSON", for people who like rust, but it is still too limited for a lot of scenarios * YAML is not as limited, but it has the advantage of giving bad people promotions and good people PTSD * HOCON has the advantage of being the goldilocks child of JSON and YAML, but nobody read the documentation * <YOUR PROJECT'S PL> has the advantage of being able to do anything and this is a disadvantage * Etc... for various reasons In all seriousness, I welcome Pkl! Configuration seems simple and I think another configuration language opens up a lot of pent-up frustration, but I am legitimately very happy to see some fresh ideas in this space. Incorporating a collection of typed records with a modicum of behavior and logic might be the secret recipe needed to crack the code. The fact that it can produce equivalent JS tells you that they've chosen a very intelligent subset of functionality of programming language features. My best wishes to the team!
- MrBuddyCasino 3y ago^ This is really the only required comment in this whole thread.
- make3 3y agodid they really need to call it the same thing and with the same extension as Python pickle files !? that's doing to be so confusing if it becomes popular
- skenderbeu 3y agoYou know why there's isn't a library for Python? The answer will surprise you.
- krick 3y agoHonestly, 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.
- kika 3y agoI'm still on the fence (and distracted by Vision Pro). It's a good-ish idea, IMHO. I'd like to see a toolkit for "reading configs" where configs are some universal format (JSON, YAML, TOML, etc) for various languages. So that the app in Ruby can share config with "microservice" in Rust and they can also maintain compatibility with completely different app (but sharing infra resources) in Go. Using one config language that supports hierarchical templates, modules, imports, whatever. Because otherwise everyone starts inventing their own "YAML with functions", "JSON with templates", etc. Pkl seems like that. But I don't like that it's Turing complete. Powerful and dangerous. Configs are inherently declarative.
- theCodeStig 3y agoHere we go again
- renonce 3y agoDeveloping a whole new language whose reference contents page spans two phone screens, with classes, built-in packages and methods, bindings for various languages and language servers for various IDEs, just to replace yaml? Seriously? Either the configuration is broken, or if the yaml is doomed to be repetitive to be repetitive (to allow flexibility etc), won’t sandboxed JavaScript do the job of outputting a readable yaml?
- TobinCavanaugh 3y agoWe programmers clearly seem to think we have nothing better to do than create edge case programming languages that solve incredibly niche problems in esoteric ways.
- limanth 3y agoDml
- limanth 3y agoDML