[HN Gopher] Apple Pkl
       ___________________________________________________________________
        
       Apple Pkl
        
       Author : fofoz
       Score  : 72 points
       Date   : 2024-02-22 21:24 UTC (1 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | spazx wrote:
       | I want to verbally pronounce this "Apple Pickle". Is that
       | intended?
        
         | jontas wrote:
         | Yes: https://pkl-lang.org/main/current/introduction/
         | 
         | > Pkl -- pronounced Pickle -- is a configuration-as-code
         | language with rich validation and tooling
        
       | midnitewarrior wrote:
       | This 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.
        
       | codetrotter wrote:
       | See also https://news.ycombinator.com/item?id=39232976
        
       | taywrobel wrote:
       | Previously posted by one of the authors here -
       | https://news.ycombinator.com/item?id=39232976
        
       | CodeWriter23 wrote:
       | Will it accept input from tcl?
        
         | codetrotter wrote:
         | HR 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 wrote:
       | If JS had that pattern for hiding `this` and facilitating late-
       | binding like that would it have still needed the `class` keyword?
        
       | eob wrote:
       | 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:
       | 
       | 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.
        
       | mholt wrote:
       | I wrote a config adapter for Caddy so you can write your Caddy
       | configs with Pkl: 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.
        
       | willsmith72 wrote:
       | > 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
        
       ___________________________________________________________________
       (page generated 2024-02-22 23:00 UTC)