8 ms·
Apple Pkl
- spazx 3y agoI want to verbally pronounce this "Apple Pickle". Is that intended?
- jontas 3y agoYes: https://pkl-lang.org/main/current/introduction/ https://pkl-lang.org/main/current/introduction/ > Pkl — pronounced Pickle — is a configuration-as-code language with rich validation and tooling
- midnitewarrior 3y agoThis looks like a winner to me. 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.
- Yasuraka 3y agoRecommend also looking into CUE https://cuelang.org/docs/usecases/ https://cuelang.org/docs/usecases/
- codetrotter 3y agoSee also https://news.ycombinator.com/item?id=39232976 https://news.ycombinator.com/item?id=39232976
- taywrobel 3y agoPreviously posted by one of the authors here - https://news.ycombinator.com/item?id=39232976 https://news.ycombinator.com/item?id=39232976
- refulgentis 3y agoPreviously in toto: - [3 days ago] https://news.ycombinator.com/item?id=39430511 https://news.ycombinator.com/item?id=39430511 - [10 days ago] https://news.ycombinator.com/item?id=39350714 https://news.ycombinator.com/item?id=39350714 - [11 days ago] https://news.ycombinator.com/item?id=39340288 https://news.ycombinator.com/item?id=39340288 - [16 days ago] https://news.ycombinator.com/item?id=39276826 https://news.ycombinator.com/item?id=39276826 - [16 days ago] https://news.ycombinator.com/item?id=39282459 https://news.ycombinator.com/item?id=39282459 - [19 days ago] https://news.ycombinator.com/item?id=39239265 https://news.ycombinator.com/item?id=39239265 - [20 days ago] https://news.ycombinator.com/item?id=39233546 https://news.ycombinator.com/item?id=39233546 - [20 days ago] https://news.ycombinator.com/item?id=39237838 https://news.ycombinator.com/item?id=39237838 - [20 days ago] https://news.ycombinator.com/item?id=39232976 https://news.ycombinator.com/item?id=39232976
- CodeWriter23 3y agoWill it accept input from tcl?
- codetrotter 3y agoHR overheard that, and now they want a meeting tomorrow :( Apparently getting out of your seat early at lunch and announcing to your coworkers that you’re gonna go “tickle my pickle” is “inappropriate for the work place” and “completely unacceptable behavior”..
- imbnwa 3y agoIf JS had that pattern for hiding `this` and facilitating late-binding like that would it have still needed the `class` keyword?
- jahewson 3y ago‘class’ also prevents the constructor from returning a different class/object.
- olliej 3y agoThe class keyword was added (as a functional syntax I mean) specifically because people understand class base inheritance but not prototype inheritance. It is literally just syntactic sugar on what you could do previously, so it’s not “needed” any more than many other basic syntax options. Not sure what you’re specifically talking about wrt to late bind or how you feel it’s relevant to this, so I am curious what you mean. But the reason the class syntax was added to the language was 100% just a programmer familiarity change, nothing else.
- eob 3y agoThis 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: Start with YAML/JSON/TOML, but then add: - Optionally strict typing and structs - Inheritance - Dynamically computed properties - Functions & object methods, which are really more like computer properties - If/Else conditionals, which are really more like a ternary .. and managed to do it while still making it look like a simple config file. The closest analogue from memory might actually be Terraform. 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.
- slowmovintarget 3y agoDon't forget what's removed when compared with YAML... white space as nesting.
- deleted 3y ago[deleted]
- mholt 3y agoI wrote a config adapter for Caddy so you can write your Caddy configs with Pkl: https://github.com/caddyserver/pkl-adapter https://github.com/caddyserver/pkl-adapter 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.
- bioballer 3y agoVery cool! You might want to consider also publishing a schema for it too, as a Pkl package. The package can simply be published as a GitHub release (see details in this post here: https://github.com/apple/pkl/discussions/85#discussioncomment-8394334 https://github.com/apple/pkl/discussions/85#discussioncommen...) Also, despite being written in Java, Pkl is distributed as a native executable for macOS and Linux (Windows coming soon). But yeah, you do need the executable installed on your system in order for our pkl-go bindings to work.
- bbkane 3y agoNeeding the pkl CLI adds a runtime dependency I'd rather not have. Is there any way to use pkl from Go without needing to shell out? Maybe Go library that calls a wasm blob or something?
- parhamn 3y agoThats awesome, look forward to trying it. If you really forced me to say anything negative about caddy (it's such a delightful tool), would be the config and the configs docs/validation. Relatedly, I feel like just having some cargo cultable config examples for basic setups would be great.
- mholt 3y agoThanks for the feedback - we're working on new docs this year actually :)
- galoisscobi 3y agoSucks that there’s no rust or python support.
- kstrauser 3y agoMy understanding is that's an implementation detail, not a design. That is, there's nothing inherently anti-Rust or -Python there, but they first worked on the languages they needed to use themselves.
- willsmith72 3y ago> port: Int(this > 1000) = 80 Yeah that looks pretty useful. 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
- behnamoh 3y agoWhy is it posted under "/apple/" but MLX is posted under "/mlx-explore/"?
- refulgentis 3y agoDollars to doughnuts, it short-circuits an infinite loop of 20 people who aren't sure it makes sense to post to _the_ GitHub and also aren't sure who knows how to get it up there.
- seabass 3y agoThis 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. 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. 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. 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.
- islon 3y agoThe community created a playground here: https://pkl-playground.vercel.app/ https://pkl-playground.vercel.app/ You can try it out and see what it generates.
- fb03 3y agoAnyone has opinions on this versus "Dhall"? Dhall seems to be explicitly total (non-turing complete) while Pkl seems to be Turing Complete, hence dangerous as you can basically compute anything
- mplewis 3y agoI don’t mind the Turing completeness. Sometimes you need it to effectively represent a problem.