← All episodes Episode #97

The Pkl Configuration Language with Philip Hölzenspies

🗓 April 05, 2024⏱ 1h 14m
The Pkl Configuration Language with Philip Hölzenspies

About this episode

We chat with Philip Hölzenspies, one of the maintainers of the new Pkl configuration language (pkl-lang.org).

Resources & links

Transcript

Generated automatically by Spotify, so expect the odd misheard word. Select a timestamp to play from there. Download (.srt)

Read the transcript

0:01 Welcome. To. Happy Path Programming. I'm Bruce Eckel. I'm James Ward. All right, Welcome to Happy Path Programming. We have a beautiful snowy day here in Crested Butte. And oh, we got a good one today. I've been looking forward to this for a while. So we have with us Phil Holzen's piece. Did I get that at all right? Yeah, you got that very close. Welcome Phil. Good to have you. Thank you very much. So this one is on pickle, which is a new configuration language that was announced a couple months ago now and I as soon as I saw it, I was like, Oh my God, this could be the solution to all of my problems. Well, and you said new configuration language like there are others and I think this is sort.

0:48 Of stands alone and and it. Is it's like the first time. I mean it's such. I mean config well what are you whatever you call them configure they're not really languages they're more I don't know declarative. Yeah they're just descriptive yeah whatever. And the undertaking a like saying, oh, what we need here is a language that's a big step. I mean that's like that's very bold and I wouldn't do it, you know, that's like too much work. So to create a whole language for just this one domain of configuration. It's the right answer. It does feel that way, yes. So Phil, give us the overview of pickle. What is pickle?

1:38 And it's spelled PKLI should point out which should be on the title, but pronounce pickle but PKL. So give us, give us the rundown. Indeed yes. In in speech you just at some point forget even to that the spelling is weird because pickle in my head is now just PKL. But it is Google able and I certainly appreciate that. Yes, that's a smart thing to do. It's much better. Than go. It does go, yeah. Depending on your cookies, you do end up in a in a sports league, but but no. If your if your cookies sort of hang towards programming languages, then and you're all. Good pickle will get you to the right pickle. Indeed, yeah. No. So pickle is a configuration language, as you said, quite poetically. Thanks for that.

2:23 But it's a configuration language that recognizes that like an ever increasing number of outages, if you read about any service outages is due to a configuration mishap and the number of outages increased. Some of the most prominent outages. Oh, we screwed up the configuration. So it seems a a sort of an obvious place for like why isn't there as much instrumentation there, where as as we have in our programming languages. So in my IDE, if I write, whether I write Go or Java or Swift or doesn't matter, I have. I have tremendous amounts of tooling. You're not going. To screw up production. Exactly.

3:08 And validation can be as simple as, you know, a typo in a YAML file. We've all sort of omitted a space at some point, or or because of some editor setting a tab, creed in, or, you know, annoying things or a string. Got converted to a boolean unexpectedly. The Norway problem? What's the Norway problem? The Norway problem is that in YAML you can say yes and no for boolean true and false, but you also have country codes and strings are not necessarily quoted. So sometimes it's like, you know, Sweden, Finland and false. Wait, what? False. Yeah. Oh, because no, the abbreviation for Norway Got it. Oh yes, That's why it's the Norway problem, because no becomes a boolean. Amazing. Once that bites.

3:54 You you brilliant language design. And it would. And it's and it is it. It did seem to solve a problem right? Because it sort of denotationalized a bunch of stuff it it seemed so much lighter. But then you get these kinds of things and then yeah, maybe there was a reason for all the heavy notation and stuff. And so so it's it's there's obviously a space there to to solve a problem in. And the problem is, whether it's a typo or whether it's a conceptual error or an administrative error, assigning more processors than you have quota for. Yeah, these sorts of errors you want to to catch before you deploy because that's how you save outages. Some validation up front to help give you some level of confidence that the configuration that you're pushing is correct.

4:49 Yeah, it's interesting how we've been, You know, you kind of see this movement towards, oh, here's something that can be automatically checked, that people have been doing by hand, let's automatically check it all the time without relying on the programmer to do that. And it's like when you think of it that way, it's pretty obvious because. And but this doesn't say language yet, right? This could say UI. Sure. And if and and maybe some people who work in UI came to this problem first, we would now do something with UIS that worked really well. Who knows? But if if you think about sort of those kinds of constraints and then think about who operates the the config, oh, these are people that are used to code.

5:39 But also very importantly, this is what I call the 2:00 AM problem. It's someone who knows how to code, but who got paged in the middle of the night, gets woken up, has the reading level of a 12 year old, and needs to solve a complicated configuration problem. Yeah. So like make it light, make it easy, make it simple as much as possible know your audience and then you you do get to you have to either be really good at UI which these are in dimensional problems and I don't know how to stick that in UI but I'm not AUI person so who knows but in language. One of the goals is to make it so that at 3:00 in the morning when your pager has gone off.

6:25 Well, hopefully first of all, that hasn't happened. But if for some reason it has, make it easy to identify where the problem is coming from, and make it easy to fix when you're when you're, you know, in the middle of the night and your brain isn't fully functional. Without introducing new problems at the same time. Right. And inherently you do introduce some new problems, right? Because like 1 great benefit of a static format like Jason is that all the information about this specific machine or this specific instance or whatever, all the information is in one place and is explicit. That's a good thing. So when you start abstracting you start hiding. But then OK, if you recognise that that's a problem that you've introduced, can you now solve this problem?

7:12 And then you get good IDE support, so you get go to definition and like debugging tools, that sort of stuff. Yeah, so by creating an abstraction we have hid some things or or made some things not as visible by the nature of having an abstraction. And that has a trade off where now you're no longer working with maybe exactly the representation that the the thing that's using the configuration is is reading. But the the other on the other side you get all these great additional features of schemas and functions and reusability with modules and all this kind of stuff. So give us the the rundown on on some of the pickle kind of language features and and things there. Right, so pickle is is lazy, which is typically, If you want to do like performance, programming is not necessarily a good thing.

8:10 If you need control, that's not necessarily a good thing. But if you want to be declarative, if you want the notation to be simple, that's a wonderful, wonderful thing. So we have objects, but these are basically they have, they have members, which are properties. There's some other kinds of members, but we'll get to that later. And but with these properties, they're basically lazy because they're lazy. They're basically zero argument functions, right? So when you don't use them, whatever defines them is not evaluated. So if you write very expensive things about queries over large numbers of files and such, if you don't actually consume those properties, you don't evaluate it. And that's great because then you can write a a very simple query and let laziness solve it for you. And so we have objects with properties and these things basically they're your simple hierarchy like Jason, except now you can refer to other fields and define functions, so to say your total number of processors allocated for this thing is the sum of the processors allocated for your login facility and the processors for your database and the process etcetera. And if any of them change for a specific configuration anywhere, then the sum automatically changes. Yeah.

9:41 So there's I guess the high level of this is that configuration is maybe very mostly hierarchical data and how do we define that hierarchical data structure especially when there is potentially relationships across the hierarchy. And so that's what you're talking about with like being able to take some definition of number of CPUs or something and do some some aggregation or some of that that number and put it into some other part of the configuration. So how do you? How do you define the hierarchy? How do you then do operations across the hierarchy but do this in a lazy and deterministic way? Exactly, yes. And so that's the there's there's an upside and a downside to it, right.

10:31 So now we sort of bias towards hierarchies, but it's sort of works out in practice most of the time because we have config for the application itself, for the infrastructures running on for. So you you sort of naturally divide an organiser configuration hierarchical, I would say There are cases where that's not the case. So think of CI pipeline configuration. Those are directed acyclic graphs, not technically trees. And you can still sort of spin them together by just name reference because you can just point to the other one and then you tie a loop. So you can very easily describe configuration for stuff like dependencies, build systems.

11:16 Yeah, that's a good point that it's not just about hierarchical configuration, because yeah, the the the Dags, right Dags in the case of of like CI configuration like you do need the a different not not a purely hierarchical structure. You need you need some references and and pickle can model that as well. Yeah, because it is lazy. You can just refer in. You can let two separate files modules import each other explicitly, and you can do that with objects as well, so you can actually. Get a cyclic issue. You get a cyclic issue if if that if that model breaks itself. So pickle only evaluates stuff when it needs to, so most of the time right? Pickle is used by people who need other static outputs. So then it's typically used as acli, and then you evaluate a pickle program and then you get a Jason and a YAML out or something.

12:19 Or it's used by service authors or program authors, right, that have a that want to consume pickle as their configuration but then populate their data structures. And the second approach is the one when I started You're you're familiar with Gradle since the pickle project uses Gradle and we had an episode a while back about my attempts to address some of the Gradle usability issues, and I've been picking away at different different attempts at at different aspects to this. But one of those is on the configuration language for Gradle. And so I started playing with using pickle as the configuration language for gradle and and in that case I was able to take my pickle, generate the Kotlin files for those pickle definitions and then read my configuration and then map that into the gradle APIs which are Java APIs essentially and and So yeah, it was great that I, you know, I wasn't like the other approach would be OK take my pickle file now generate a yaml file or something and then parse the yaml file. It's like no like like I just want an API to my configuration. And it's cool that pickle gives you both kind of directions into to what how you want to deal with your your configuration, either programmatic or just a a mapping into to a static file. Yeah, now that's that's entirely a good point and I think the so it's worth a mention Peter Niederweiser as a name drop. He's the the person who started pickle and the insight that he had was besides.

14:04 Oh, a language is a good fit here well, and many more insights leading to Pickle. But the insight that he had was also. I want to do his words justice and think of how he said it, because it was quite good.

14:21 Did I just lose my train of thought? I just don't think I did. So configuration. We've got this configuration format and then we have different ways to process it. And so it seems like that was one of the initial goals of pickle was to not just be a a mapper to a static to a static another static format, but also provide the programmatic interfaces to it. Right. I I regained my chain of thought. Thank you very much. Perfect. So, so Peter jumped back and said, look, I can solve these problems that I know that I have or that I know that people around me have handling services. Or I can take a slightly more fundamental step back and say, how do we keep doing this? Because there's already a bunch of things that say, OK, basically you want static Jason, but you want templating, right?

15:14 So then you get Jason it, which solves that problem. But now you also have a YAML file because you simply also run on a infrastructure that needs YAML as config. Right. So they need to have different representations. And normally we duct tape that stuff with with other tools and like, you know, rewrite this Jason into YAML and yeah, all these kinds of duct AP tools. But like, what if? What if you see the whole thing as one problem, And that's what he what he sort of designed Pickle 4. Yeah, I I think, correct me if I'm wrong, but I think when we explored this at the Winter Tech forum, I noticed that you had objects but not inheritance.

16:01 Is that right? We do. You do inheritance. We do. Yes, we have single inheritance. So normal extents of normal type system. Yeah, so that allows you to to have. Let's see a practical example here. I'm trying to think if I used inheritance on the pickle GitHub action stuff that I was working on. It seems like there's places where in their model you've got a job and then a job has steps and then steps have other things in them. And I was trying to think if there is any place where I used inheritance and I don't know if there was but I'm sure I will at some point as I go further with that uncover.

16:49 Oh, this thing has some of the same shared structure as this other thing, and so let's create create a a parent class for that thing and so that so that we don't have to duplicate. Those pieces, it tends to be that. So you you can either do something where where you do by composition just by by holding objects inside objects, or you can do something like, oh, I'm going to you know, I have 5 variants of something, let's say of a of a of ACI pipeline. So you've got like testing pipelines, and you've got build pipelines and you've got. So you've got some sort of basic profiles and they have a few parameters each that are not relevant for each other. You can just give all the parameters in one structure, make them nullable, and add a condition saying If it's this flavor pipeline, then all of these things must be there, and those things must not be So you can do that, but that doesn't scale really well, and at some point you get stuff that really has nothing to do with each other and it just gets to be confusing.

17:45 Yeah. You're just bloating these definitions when they're not actually shared Shared definitions. And yeah, I mean it's cool that you can make them default as as null and then then you don't have to even think about their existence. But sure, is nicer when your when your schema can match the reality of how you're going to actually use it. Yes, and so the basically the the design constraint there is how is it so? Typically when you really like wiggle down on a problem the the problem itself, the the path to the solution is often to find the simplest way of expressing the problem. And so how do you make it obvious what the simple way of writing down the problem is and like that problem isn't solved. Like I still struggle with a whole bunch of problems I know about and I run into.

18:36 Yeah. But you sort of go for those places where OK, here, here, there's a lot of friction. Can I make this easier? And there should be an intuitive bridge that that solves that problem. Well, and here's what I hate about declarative languages generally, is that there's no reusability. There's no a way, there's no way to take some some common thing and turn that into a function or some other higher level thing. And when we were at the Winter Tech Forum exploring pickle, we're like, OK, let's start with GitHub Actions. I hate how much boilerplate there is in GitHub Actions. So the the first thing that we worked on was, can we start creating a GitHub Action replacement.

19:22 You know, so I can write my GitHub actions in pickle And we turned our we started. There was two different builds that we started like, OK, we're going to migrate these two builds to pickle. And the first one was, I don't know, 15 lines of YAML, so it wasn't a very long one or something, you know, it started very simple and we got it down to like 3 lines of pickle. And that's like to me, it's like I I just so despised that in declarative languages there's no ability to do that. Like higher order structure where I can create a reusable thing and then that reusable thing can be based on other reusable things and and in pickle it's like oh. Like at that that point when we got that working at the Winter Tech Forum, everyone was just like sold, like like so sold on having a language that allows us to have actual reusability. And so yeah, that was that was cool. And we were able to get this all working with knowing very little about pickle and just kind of stumbling through. And guessing, that was.

20:29 The nice thing is that you could guess, and your answers were almost always right. I don't know if we yeah, we were very impressed with the guessability of the language. We were expecting a lot of toil, yeah, because that's typical in these domains and within a couple hours we had at least two builds migrated over to a shared module with the GitHub Action stuff in it. And a pretty good grasp of the language, yeah, yeah. Yeah, so I guess the surface area is small enough that it's learnable. The Intellij plugin that we were using was awesome. And so yeah, it was just, it was way more delightful experience than we expected for how quickly we were able to make progress. Typically when you embark on some project like that, you're expecting days of turmoil and we within hours had had stuff working, had replaced our GitHub action pipeline to use the pickle file. You know, obviously we have to still generate the EMO underneath, but but yeah, and and then there was things that we didn't expect to work.

21:32 We're like that. There's no way that's going to work. And then it just worked. We're like, wow. Yeah because of the strength of the language. So have you thought about using it as I mean this came up this morning a build system in other words can I replace I mean not yet cuz James pointed out well you needed an you need an engine beneath it. But is this been on the? Has anyone other than me explored defining their build with pickle? Yes, people have have tried that and there's some there's there's someone on did I see it on a Discord or did I see it on AII saw it maybe in our discussions or maybe on a Discord discussion somewhere that that someone was working on their build system.

22:21 The thing that I'm still working on that I'm not entirely content with is is multi stage definitions. So build systems. As long as it is a straight straightforward dependency definition, pickle is already there. It's like comfortably there and you don't think about it, you just write it down. But when the result of a of a stage in your build needs to inform the config of what needs to go, and you want that to happen in pickle. So when you run pickle multiple times, as it were, that's not clear to me yet what that looks like, other than of course just multiple pickle files, one for each stage, where you just provide these things as input. Yeah, so the in the case of gradle where where I haven't tried to go yet in my explorations with using pickle is like task definition. And I think that's an example you're talking about where I need to define a task and it turns out that the output of that task gets used as an input for another task. And that's where things may get a a little tricky. So maybe, maybe purely if I'm not doing kind of task definition or any kind of runtime dependent information, then then something like pickle could work. But as soon as I get into a space where I need programmatic runtime, uh, outputs to then be used as as inputs elsewhere, that's where where things get a little bit trickier. Yeah, and like it can be done, but it's it's just not it. It to me it feels less fluent and I and I'm not entirely sure yet because it's, you know, we're it's configuration language.

24:01 It's supposed to stay simple so you also don't want to stick too many bells and whistles in. So not entirely sure whether it's a pattern that is the answer to this rather than a language feature or a or, you know? Yeah, and that that's one of the thing I've been curious about with Pickle. And this relates to what I've dubbed Getz's law Brian Getz, where he he stated and this was summarized from some tweets by him. But something along the lines of every declarative language slowly slides towards being a terrible, terrible general purpose language. And that's I I think what you're highlighting is this this like gravity to trying to pull this declarative you know this language that has all these constraints for good reasons on it eventually getting pulled down into oh, but we just need this one other thing And so how are you looking at that Like like how how how do you know where to set the boundaries for no, we're not going to do that.

25:01 I mean in part it's just a it's just a prioritisation thing. It's it's a small team that works on this. So we're we're three people in the core team. Dan and Islan are my my colleagues there and so So that prioritises stuff with limited capacity. But then more so like for fun, every once in a while we or now other people write like Advent of Code stuff in pickle that very quickly runs out. If somebody reasonably says hey, I'm I'm getting like out of memory error. I'm getting an overflow here or a thing because I tried to do this heavy computational algorithmic thing in pickle. Well, you know, sorry. Like. That's not a priority. We have other scalability issues where we do have priority, and scalability in config is much more. For example.

25:56 How do you, How do you maintain large mono repos of configuration? Right? Infrastructure is code sort of design philosophy where you have multiple teams maintaining multiple services all together in one sort of pattern in one mono repo. How do you manage that? How do you make that skill? How do you deal with separate ownership and versioning and these sorts of things? Yeah, yeah. Yeah. So it seems like like there's some just resource constraints on how far you can take pickle. And then there's the IT. It seems like a desire to keep to maintain the ability to deterministically create static static representations of the configuration.

26:45 And if you if somebody wants a feature that would break that ability to create a static configuration, then then at that point you're like, yeah, maybe we've maybe we've going too far or something. Those those priorities for sure we want reliability in our type system we want. So although the language itself is technically entirely dynamic, we do try to make it so that the IDE can actually statically analyse the types so that it can inform you without actually evaluating anything. And so that's that's a little bit cheating, right? We we take the best from both worlds because fundamentally it is dynamic and fundamentally the source of truth is the interpreter. But ideally you have on the fly type information.

27:31 Yeah, yeah. And so in my usability of it, that's worked well. You know, the code hinting is is fast and accurate and I certainly appreciate that. Why thank you, no. But it does so so that that's certainly a a a design sort of element that we aim for to keep because that does something to simplicity for the configuration space problem. So technically it's during complete. So we could argue, you know, it's a programming language, It's a general purpose one, and it isn't. And it's kind of, I mean you've it. It looks like you've tried to do a lot of functional ish things with the language like everything is immutable, right? You don't.

28:16 There's there's no variables, it's only values. Is that right? Yes, this is correct. OK, so that puts the. We have. We have variables local to expressions because we have let expressions. So the language purest in me now feels that I almost lied to you. We do have variables, but not in the in the reassignable. Sort of. Well oh God yeah. This argument, it's like, yeah, I've had this argument before. It's like if you're going to call it a variable, that means it can vary. So otherwise it's a value. I'm. I'm like mathematicians sometimes disagree. I'm I'm perfectly happy to leave it there. Yes, this is not a principle matter. Yeah, yeah. And it's really helpful to just say. It's immutable, yeah.

29:05 Yeah, it's immutable. Everything's immutable. So other language features that are worth highlighting. So we talked a little bit about reusability. And reusability I think has multiple forms. There's, there's templates, there's objects, there's functions. Then you can package those things into modules and share your modules and. If we were going to ask, are there higher? I mean, do you have higher order functions? Yeah, I mean like technically, yeah, functions are are first class values. It there is a notational thing. The thing that you write down function Foo for is not. You can't refer to Foo without calling it. So if you just type Foo without the parentheses, you don't get an object that represents the function.

29:50 Gotcha. So you don't have that, but you have lambdas instead. So you can wrap it in a Lambda. Yeah, that's a little finicky sort of sort of thing. So they're not quite 1st order, but. OK, yeah, but it's possible. So reusability, it's amazing. It's so great to to have the ability to to have all those different ways of of having reusability. So I think I don't know anyone want to say anything about reusability with pickle. I think it's one of the best, best things about it. Yeah, it's and it's. You mentioned type like templates and values and and that's a very good point because reuse of values is a very common pattern in in config And yeah that's been and a thing that I've been running into now talking to users picking it up who are very enthusiastic about it who do who get it.

30:43 Like when I see the code and they go OK, clearly you're thinking in the same patterns that we're thinking in. One thing that isn't quite as obvious that pixel can actually do really well is it can use file structure, file name structure directories to inform a bunch of stuff. So you can read the name of a file that's very useful in a in structured configuration in a place. So for example if you you know have an object where someone I published code yesterday which is game state or or game model rather. So they define factions, and factions have buildings and units and these comes in types and stuff. And then the file name is the name of the building and then there's a field called name which is the name of the building.

31:30 And then there's a an escape field with hyphens and such because you need a slug. So you have all these different variants of essentially the name. You can all of that derive that from the file name. Yeah. And and pickle does that very simply. You can do that in the template so that you never ever see it, but you just say this is a a a unit in this in this game model case. And a unit means, oh you know, we have these fields, but also these values are automatically derived from the file name. Yeah, yeah. So derived properties. That's a huge, huge thing for reusability and being able to run functions on values. There's a bunch of string functions out-of-the-box, and and so and then default values.

32:16 Another Another great language feature that that, yeah makes. It makes it reuse just more concise because if something has a default value and I don't need to override it, then I don't have to see it or care that it's there. So that's a good one. You were gonna ask about, like, reading a version number off. Of Well then we discovered it. So one of the use cases that I have been curious about is the whole area of side effects. And so I think generally pickle doesn't support side effects except there are a few places where you can reach out to the external file system or external network or an environment variable and those become essentially like the way to to have some some side effect in in your pickle configuration. So yeah, give us the rundown on on your thoughts around side effects, what what, how you decide what side effects should be allowed and and how that ends up working in pickle configuration and keeping it deterministic in air quotes. Yeah, so I mean the the letting it be deterministic is is sort of a goal and you can't reach that entirely, right? So what's the other one?

33:29 Works on my machine. Yeah, so the works on my machine. Problem. We try to minimize that. You can read environment variables, so you know you can read files. So maybe you still run into works on my machine problems, but these seem simple and like detectable and resolvable and so all. We do allow inputs because that is often necessary, but all inputs are cached. So you can read an HTTP resource, but it doesn't mean you can like back and forth on an API, because if you have the same request twice, you will get the same answer twice, even if a service would give you a different answer. Interesting. Because every resource is cached by its URL. And as an upside, it makes it makes pickle much more predictable, much more reliable, and much more intuitive. So so lower surprise basically.

34:28 Yeah, and that's the main. Side effects gives you mostly deterministic behavior and and when needed there's a bit of an escape hatch there. So the the use case that Bruce was pointing out was. One thing that I have to do in my gradle builds is I read the git tag to determine what the great old version should be set as and and one way to do that with pickle would be to just pass it in through an environment variable. But then I need to move, potentially my, you know, move the logic that sets that environment variable out to somewhere else. But then we were reading through the documentation. I hadn't even known that the other possible side effects were reading a file, and so it seems theoretically possible that I could read, you know, the git git information from a file or something like that. Which maybe, I don't know how hard person to read that file is.

35:21 It seems like maybe there's some potential way to to get to what I was trying to do there. There certainly is through environment variables, but maybe through the file access if the if. The file in question is Jason or Yamo. We actually have parsers for that and pickle that. You can use to consume it as if it's a pickle structure. Yeah, but so, so for that kind of scenario that we do have that instrumentation specifically for that so that you can read that you know git repo state or something, but only once per execution and that's that's a distinct choice. That's where it's not a general purpose language. That's where it really has that that application of configuration in mind. Yeah, well, no. I have thought about it totally fine to to to have that single read. That would be fine for that particular use case.

36:09 Right I I have thought about just to nerd out and if if this is too far down the rabbit hole for your taste then I like it homies, let me know. But about the DAG problem, because you can use pickle as a library, and because it is lazy, The thing when you use it as a library, you can make consecutive calls to read properties.

36:30 And since properties are only evaluated when asked for them, you could basically ask for the stage 1 result interpret in your programming language, whatever you need to interpret, run your your your build stage, read your file, inform it, and then in the next stage have pickle read an environment variable that you only set when you call back into, yeah, pickle. So there's. There is a potential way to to create a terrain complete system there with. But you don't. Well, you don't have a feedback loop unless you build it explicitly, right? And that means that it's still very unlikely that you shoot yourself in the foot. Yeah, so other features that are worth highlighting, nullability, being built in, I love.

37:16 I've been doing a lot of Kotlin and so it definitely seems like pickle has some common language features with with Kotlin like nullability and it just is one of those things where I'm like oh thank God that's in there and I don't have to deal with with null pointer exceptions and all that. So and then the nice like do you? Does pickle use the Elvis operator for a default value on a nullable I? Forgot we have the the double question mark. OK, double question. But yes, null coalescence is extremely important. Like nullability is nowhere near as comfortable without us. Yeah yeah. And for configuration like the last thing you want is is to have a null like crash your production system. So yeah, having that in there is is huge. And then I think the other language features, I think that there's something like some types in pickle. Am I remembering that correctly?

38:08 Like the ability. So it's like an enum, right? There is enum so it's it's essentially like like the the way to create a some type. Enum is also a little bit of of a term that depends what language you're from, how you interpret it. Enum is a different thing in Swift than it is in No Camel, and it's different there than it is in Go. But we have we have union types and the the sort of the base case enum where you just have static labels. Basically as a subtype of int is an A union of string literal types. So string literal types is where where the type is 1 string constant. So it can only be precisely That String is incredibly useful. I love this. Yeah. Yeah, when when I was doing the GitHub Action thing, it's like there's let's say platforms and platforms in GitHub Actions. You know, there's twelve different options for platforms or whatever.

39:01 And the fact that I get like code completion on the possible platforms when I when I set that property or the platform property just like, oh thank God amazing. Right, but it's. But that is not just normal like limited enum. So it's not strictly of some type, right? It's a type union. So you can do you know my dev environment and my prod environment and my QA environment or string. And that means you get the autocomplete right? Because the alternatives are known to the IDE, but also you have the flexibility to do the the thing. Escape. Yeah, yeah. You have the escape edge for your system where you know what you're doing, yeah? Yeah, so just to summarize that, you can you can define a type which is Windows X86 or Linux X86 or string and that gives you the ability to then then have a property of that type that can be those two that I said or just whatever the user wants. So, but that's if you want that.

40:08 If you really did want to constrain the user to just the two that you have have specified, then don't put. With the OR string on the end right. Exactly, exactly. Yeah, so so union types. Great feature there. Yeah, there are so many out-of-the-box like string functions which which I found really handy for. It's like why would I want to have to have some preprocessor for my configuration just so that I can like do do some little string manipulation in my configuration. So great to just have those things built in, like lists, maps, listings, listings. Yeah, question for you. Give us the reasoning for the naming convention there of listings and mappings Set settings. Yeah, this is weird huh?

41:01 Set gets cuz there is a set right? But we don't have settings. Because that would be. Confusing. That would be weird, yeah. But also the things, the things that we have are are are structurally not set. So because of the underlying framework we wrote this on, on Truffle, which is a language framework, you write an interpreter, you get a compiler. It is. It is a very nice and powerful framework, but but it does lead to some sort of operations being more expensive than others for us with immutability and the like. So if you do a whole bunch of like, filter, filter, map, map, map, sort of things on your collections, then at some point that becomes expensive.

41:48 We didn't optimize for that. At some point we might, you know, if someone has a bright idea on how to do it, great. But we had sort of basically these two different scenarios. One was optimized for notation and those are the things, so the listing and the mapping and and the other one is OK. At some point you want to do all those computations because you know you simply need to to sum all the resources that you've defined for your system, or you know stuff like that. And so the the the short versions list, map, set. They're made for computation and you can go back and forth between them. Yeah, yeah. So two different APIs for working with with collection structures. Well, two different ones for each type of collection. So List and listings and so depending on what you're doing and what you need, you can pick between those those two for a list structure.

42:48 So there's yeah lists, then there's maps, but no set. So there is a set, but not a setting because there's this one other language feature that is so transparent in pickle. I was I was kind of just hearing you out on language features to see whether you would mention it because the foundational language feature is amending. So it's where you say this object is like that object except and what that does in file hierarchies is you can you can say this file amends dot dot dot which means you know go up until you find a file with the same name as me and then everything else in the file is except. So you can make these things where you have your service definition and then you make AQA sub definition that says it's exactly like the the normal production service but with only one, only one core or you know on a different cluster or stuff like that.

43:50 And then that's the one thing that you see. And we also have that in objects. So you can say this object is like that object except so you say object name between parentheses and then curly grace, and then you start saying these things are now different from from that other thing, and that's incredibly powerful. An override. It's an override, yes, but it's, so it's. It's a prototype override, right? Like JavaScript objects, OK, the type overwrite sure, because it's value value chaining. OK, so amends with settings would be problematic. Is that what you're getting at? So for collections amends is additive, like for properties. If you have an object with you know, CPUs and memory, then if I amend it and say CPUs is five, then clearly that should mean it overwrites the the existing property. But for collections that's not necessarily the obvious thing. For like lists it it it's actually slightly more obvious to add stuff.

44:54 So if you amend a listing then you add elements to it.

45:02 So that sounds a little finicky, but if you see it written down, it just makes more sense it. Makes sense, yeah, yeah. And mappings as well, right? You if if there you have the ambivalence that if keys already exist then you change the key, so then you override. If the keys don't exist, then you add the key. Yeah, and so is it. Was there a a challenge with doing settings because of the amend amending? Well, if it's strictly additive, you get an order problem. Right now it becomes very hard to understand what you actually intended, but you can just have a listing and at the end of it say I want that listing except distinct. Yeah, and distinct. We give you this, yeah. Sure. Yeah. And then with errors, you do not have any recovery mechanism. Everything is basically a panic.

45:48 Is that correct? Yes, because otherwise you can make errors into a Turing machine as well. And then and then yeah. So ultimately you shouldn't want to catch 'cause if you want to. If you're doing a catch, you're you're doing a type of computation that isn't the conflict domain, and you're making it hard to follow where values come from. Where do you see people using the exception or panic mechanism and pickle? What do? What do people use that for? I mean, they use it for for more complicated failures. So sometimes you layout your config because you have a target system and you want to lay it out the way it's laid out in the target system. But that does sometimes mean that the targets if the target system's layout is not designed to avoid non existent states or illegal states.

46:41 So if they are expressible then they are expressible in your, in your set up, in your configuration, in your template. So a way to then to catch that is is when when you have a null when it shouldn't be. At some point you have a function that makes a non nullable. That makes it a nullable and non nullable simply by asserting. OK, that's a point where it might break. And if it breaks, what do you do? Well, there's no recovery that's meaningful in that position. So the only recovery is an error. I see. So so uh, you may have a case where you've got some particular set in and some systems it can can be null and that's OK. But then in some other places you actually don't want to allow the null, but you want to reuse that property. And so in those systems you can say, all right here I'm going to now throw throw the exception which is going to panic and not allow the configuration to be generated for for that one because I haven't said it.

47:43 Yeah, and so there's there's one other thing that I've started using it for, and that is when you have things that simply fail hard when constraints on types, right, you can have arbitrary functions there. You can say that you know a string that only contains letters, hyphens, and and digits because it's a name that goes to a system somewhere. OK, great. Now that that function, when that fails, you get a regular expression didn't match. This is still a straightforward example. You can see you know node name has to match this regular expression and this condition failed. OK, that might be comprehensible for someone who experiences the error, but very often there's a distance between the template author and the end user. And so instead of doing that, you can say condition or condition or condition or throw and then a message that is an actual explanation of the specific constraint that failed. So you have a node name here which may only contains these these symbols because it goes to that system and that system only accepts that and otherwise it breaks. Yeah, you know, so you can make it more informative so you can actually throw is very important for UX is what I'd say. Yeah that makes sense giving people good error messages. And I just want to come back and highlight this because another great language feature is the conditions. So you can define and and it's been a while since I've played with conditions so you can correct me if I'm wrong. But what I remember is that I can have a type like let's say a string, and then on that string I can set conditions must start with an uppercase letter for example, and I will get an error when I try to actually evaluate my pickle if I try to give set this property to a string that doesn't start with an uppercase letter.

49:35 So I think in functional programming world we would call this like almost like value dependent types or something like that where you can't actually construct that string and set it to something unless your conditions are valid. Did I get any of that right? No, you got that exactly right, except we call them constraints, not conditions. Other than that, spot on and it's and it is very. Out-of-the-box ones that you can use and then you can create your own. So it's a different way to create a type. I mean, because you are by putting that constraint on it, you're defining a new type, yeah? And and you have pattern matching. I mean not pattern matching, but regular expressions. You said as well. We have regular expressions and. But, but. But these constraints can be arbitrary functions, sure, so.

50:21 So these can be anything, right? And indeed that is exactly like dependent types. But the downside of a dependently typed language like a, an Idris or a or a these sorts of things is that as like whatever you write down in the type you must provide a proof for, and that proof is is in code. But then a whole separate sort of can of problems is how do you now prevent other other programmers from ever using that code? Because that code was never intended to be used as a value, and it's very expensive, so you don't actually want to compute it, you know so. So it's it's awful. It's an awful lot of work for a noble 'cause we just check values as they pass. Yeah, that's and that's the great thing about pickle. Because of the constraints, it allows you to have essentially value dependent types, but without all of the pain and headache normally associated with value dependent types. Exactly, exactly.

51:19 So you you you are as expressive in your constraints as with full dependent types and you have to do none of the work. Yeah, it's amazing. One of the really cool things about pickle and and this can apply. You can apply constraints to any type, right? So if you want to constrain an int to be within a specific range, you can do that. Yeah, and then think of what that does to union types and collection types. Because if I have a mapping of string to int, then I can put a constraint on the string, I can put a constraint on the int, I can put a constraint on the entire mapping. Yeah, And with unions I can have all kinds of separate types of things that I'll accept. So it's a super powerful mechanism. Yeah, and for me, I guess this is the Haskell ISM or something like that, which I've never really done Haskell, but I love the philosophy of make illegal states unrepresentable, and to be able to do that in configuration back to where we started in this conversation was being able to verify that my configuration is correct before I push it out to production. This is just one more piece to being able. To well and you combine that with immutability means that you go, OK, I created this thing successfully. I never have to think about it again. Yeah, yeah.

52:41 And and and what is it? It's what you wrote down. Yes, right. Exactly. But what if this happens first? There is no first does not exist. That's right. And where did the idea of constraints come from? Is this? Did did you invent that for this language or did you find it somewhere else? I mean there. So there is the notion of dependent types that are essentially the same thing. OK, but in in this case specifically, it's OK Now you've got string and int and such checking, but now you still make typos, you just don't make it in your YAML structure, you make it in your identifier. But but you're still a foot gone away from from an outage, right? So OK, now these these identifiers should actually be this limited set or should all comply with this or you know? Yeah.

53:32 But the number shouldn't be a billion. But I could see this concept being used being added to a lot of other languages as well. That's what I'm. But you can't in a general purpose language without a lot of challenges because the. So the typical way that you would do this in a in a non dependently typed language is when you you would have like a constructor function and then you would apply your constraints on that and then you would like return an Option to say like hey you know you're I'm giving you a none back because or a null or something because I couldn't actually validate that this was correct. But in the case of pickle, because it's constrained, it can actually say I'm not going to actually allow you to construct this type when I evaluate your configuration.

54:26 Because it's it's been able to run the the constraints before construction of of the thing. And because it's like, you know, kind of, I'm thinking about it as like a single pass through the configuration processing. It can then stop and say I'm not going to allow this configuration processing to continue because you you did not pass me a valid value for this thing. Yeah, that's exactly right. Yes. And it only happens when you need it, right. So the other thing is you can write down these these, you can write down expressions that are not well typed wilfully. As long as you don't use them, you know that doesn't matter, they don't get evaluated.

55:16 And so for the constraints the you can write arbitrary functions because unlike with the normal with with let's say Kotlin or Swift or Java, you compile right? And at compile time you have to check the types. That means that you infer all the possible type, all the possible values that could happen in a space, what types do they have? And then check it against the declare types. We don't have to do that because at the time that we compile is the same time that we run. So whatever values we see, we can check because we don't have to extrapolate all values, we just have the values that we actually see, yeah? Exactly, yeah. So being able to not having a compile that creates a program that then at runtime wants to apply constraints, you just you're in like 1 one phase of. Now you go through the whole thing and make sure it's all valid.

56:09 Exactly. Yeah, you I noticed you have a, you know, a limited set of output formats that like you don't include Tamil for example. Are you going? Is that just because, oh, we're just getting started and we will add other output formats? We've even been discussing whether we should be removing output formats as in as in. Let me caveat that. Very importantly, no panic. There is a tomo renderer that we have in pickle pantry. So in pickle you can write a valid renderer for tomo, and so we've been talking. About reusability. Because there is reusability. A renderer and the renderer then does your. So it's great that renderers are not built into it, they're actually just calling other pickled things to do the rendering, right?

57:06 Exactly right now, except that some renderings become very involved. You wouldn't it. It's surprising if you think that Yamo was actually intended to simplify syntax, but rendering YAML involves a lot of decisions about do I actually need to quote this string? And you know, people prefer unquoted string, so if I don't need to quote this string, I'm going to put it on unquoted. So are there spaces in? Are there new lines in? Isn't it? Remember. The winner tech form where we're like reading the YAML spec and we're like, is this thing supposed to be quoted or not? And it's like, what's the correct list syntax for this given thing? And then there was actually differences between the YAML spec version for different ways that it handled those things. And it's like, wait, which version of the YAML spec does GitHub Actions use?

57:54 I don't even know. You know it's. Minor versions might I add. Oh. My God. Oh my God. Which is also for for the point about Tamil is uh, at the moment we're still awaiting Tamil 1.1, I think. I think at this point I'm not entirely sure. It might not even it might have stalled entirely. Yeah so yeah who knows. So very possible and to create a Tamil render and there is one that exists in the pickle pantry. Two quick things I want to one thing I want to ask about first. Is there a future that you imagine where instead of having to have the yaml file for GitHub actions or Kubernetes or whatever, where I just give GitHub actions my pickle file and it deals with it?

58:44 Or is that not the future that that I should hope for? I I I mean, everyone in the future will use pickle of course. I mean, if I can help it, sure. There's there's just a AWS cloud Foundation just published their their templates. So it's starting.

59:05 Will we conquer the entire world? You. Just give it a pickle file and that's all they need. You just give it a pickle file. That's it. That's the definition you give. That's the authoritative definition. Love it. So yeah. And I I genuinely believe that that it solves problems as your reaction as as reactions that we've seen from community. It genuinely solves problems and and people everywhere who who work in like systems whether open source or or from large corporations, right. They want to solve those problems. That's why they're employed right here is a tool. Yeah. Fewer thumbs, better hammer. Because at the end of the day, why do we need that intermediate representation?

59:51 It only It only is there because it's easy for GitHub Actions to parse. It's easy for Kubernetes to parse and do something with. But if we could give it a more full-featured definition of what we're trying to do on this other system. Why not? Why? Why have to go through that intermediate representation that's parsable when I could just give it a pickle file, let it use pickle to then run the pickle, maybe even programmatically, and then it get an API to the configuration and decide what the system does. And it's all sandboxed and all the wonderful, you know, constraints that pickle provides. So I certainly hope that we get to the point where pickle just becomes the language and we don't even need the renders.

1:00:40 Anymore, because right now with GitHub Actions, to find out whether your thing works, you actually have to run it. Right to render the yaml and then give GitHub actions the yaml. Uh huh. And so you've gone from this. Very nice. It's great that pickle can generate the yaml, but why? Why is it even necessary? I'm just trying to tell GitHub here is my workflow and I don't like, I don't wanna use this very terrible declarative language to do that. But what I'm saying is that if you're just using YAML for GitHub Actions, you can't check it until you upload it to GitHub Actions, whereas if you're using pickle, you get a whole bunch of checks. So that's right, the schema validation. Yeah, all of the validations that I've started putting into you my GitHub Action, pickle module all give you some level of confidence.

1:01:31 But you're you're right that GitHub Actions doesn't provide any way to actually validate that the thing actually is valid and tell you upload it up to to GitHub, right? Yeah, and I think so. So an important bit there is that a trade off? You said fast to parse, right? And then we already discussed a whole bunch of ambiguities in in YAML. So. So, caveat. Caveat, yeah, but it's also that where is that choice to be fast apart? Where is that critical? If it's data that your system rolled out, yeah, sure, you want it to be like, fast, but then you also trust it if. If the whole point is that it comes from human users with different levels of knowledge about your system, calibrated on different versions of your system with different histories, blah blah blah.

1:02:19 I don't know. Different locale settings, so different kind of characters sneak in. Maybe that's the side where you need to stick in some, you know, instrumentation to safeguard invariants and and so that's if. If that is the the cost consideration, that's a great application for pickle, basically.

1:02:46 I sure hope that Kubernetes and gab actions and all these systems just give me the ability to, well first give me the schema like I want, the schema like that's that's critical, and the ability in pickle to define the schema amazing. Thank you for giving me the ability to at least validate that this thing is correct before I upload it to you and then give me the ability to just push my pickle file to you and so that all that would be amazing. And this is if I. Might point out if I might point out just just on that point. Uh, there's also written in pickle a thing that translates open API spec to a pickle template. So. So you want the templates. Well, if they don't give you the templates, but they give you the Open API spec, we will give you the tool with which you can get the template.

1:03:32 And I think I saw that you're using that for. Maybe the Circle CI UMM pickle pantry module is how those are being generated from the Open API Opening API for Circle CI. Maybe. It's the, maybe it's the Kubernetes. Circle CI we haven't done the generate. The Kubernetes is one we generate OK, the circle CI doesn't. I don't believe it publish open API. Yeah, so. I may be wrong, in which case great no, this is just because because our repository. Method exists in Open API form. You can generate the pickle schema from it. And there you go. Amazing there. You go. So I think it's worth talking for just a second about modules, because in this whole concept of reusability, it's great that me as a developer I can build reusable things for me and my team. But the fact that pickle out-of-the-box said we're gonna allow you to publish these modules and then have an import from an HTTP URL for that module. So now you can reuse modules.

1:04:29 Amazing because now we can have the whole ecosystem of people building Pickles and reusing them anywhere. It's just the the whole like library ecosystem for configuration. And this of course is all supported today. And pickle and and if you want to use my GitHub action pickle, just import it. It's. I don't know, I don't remember the URL for it somewhere on my GitHub, but but you point to my URL and great, now you're defining your your GitHub actions as in pickle and you didn't have to write it. And I should say this whole GitHub action thing that I've been working on. It's not very far along so it needs a lot more work but but at least as a start and highlights that this is all possible. And another amazing thing about this is you said when you have a published module for pickle, you probably also want documentation for that module.

1:05:19 Because now that we've got a schema we can now define, we can now have documentation so that people know how to use the thing and know what this property actually means. And all that so you can generate the pickle doc for your modules as well. Just love it. Including hover over support in the IDE. I'd like to oh, I love that. Yeah, exactly. Which is incredibly valuable when when names are in terms of art of the target system and you don't speak that language, then a little hover over with a little bit of explanation does a lot of work. By the way, you said modules and you can directly import them through HTTPS. But then of course if the host changes the thing that they serve, your behaviour suddenly changes. We also have packages and. Packages give you versioning and version resolution of dependencies and the like.

1:06:10 So if you want to not trust the vendor of your template, don't HTTPS directly to their module, Use a package. Yeah. So that's like like essentially importing that package to your to your environment so that then it's kind of statically locked or something to to the version that you've that you've pulled down. Yeah, we published them with Shaws. So. So version one has this Shaw and then forever shall it have that Shaw? Yeah. Great. So you can do that initial kind of import to your environment and then never have to reach back out to that HTTP URL because it may go away. You know, we've seen node modules just disappear and that breaks builds. And so pickle packages allow you to avoid build breakages by by cloning that that pickle locally and and and maintaining the Shaw reference there, so you can be guaranteed that it's not changed. Great.

1:07:06 What? What else did we miss? That's like I don't know great about pickle well. We also, I think we're going to talk about your aspirations for the future. Not a road map, you said, but aspirations, ideas. I mean so. So I think we're we're this one item that I already mentioned that it wasn't easy yet to write things where you use the results from previous stages where you do a multi stage build a pickle. So that's something that I've been thinking about. I don't know whether that is a pattern or a language feature as I said and with that regard, we're thinking of aggregating a bunch of what we think are good patterns, but we also want to like properly put them to the test.

1:07:54 There's small patterns, you know, like how how you do if you have a bunch of constraints to check, how do you make a nice user experience and such. There'll be blog posts and and there's ongoing discussion in community because we're not necessarily the one and true source of patterns. People are using it and saying, oh this is convenient, which is great. So a pattern collection is is very much in future and there's ongoing work, right. So we're currently working on on on LSB. So to cover more editors with the language server protocol, and also to connect to other more build maintenance and and code maintenance sort of style tooling. Yeah, lintors and and the. Like, yeah, Lintors, Yeah, that makes sense. One of the things that stood out when I first saw Pickle was often times when somebody announces some new new language or new declarative language or whatever, they're like, we've made it declarative so that we can have great tooling and then guaranteed, like the great tooling never comes. You know, it's like, like you said, you could have great tooling, but you never actually built the great tooling around this declarative language.

1:09:07 Possible, but it's possible it just never happens and out of the gate. With Pickle, it's like, oh, you've got your Intellij plug in, you've got your VS Code plug in. You've got a build system that can, you've got the repple like, you've got all the like things that you've got the documentation for Pickles, like you've got all these things that people hope to someday get to when they create their new declarative language. And pickle just has it. And I love that. Wasn't just like we can do all these great things. It's like, no, pickle did all the great things. So I I appreciate that. Well, thanks very much, but there's more things and and there's more great things that we don't even know about because it it, it is fun to see the world pick it up and and do stuff with it where you just don't expect it. Oh.

1:09:55 Yeah, that's not that's entirely not what we intended the language for, but it's undeniably a great fit. Yeah. Well, the, I mean, the problem you're solving is so obvious and huge. Like if we're getting all of these failures because of configuration and they're causing who knows how much money and waking people up in the middle of the night and all that kind of stuff, you know, it's like, oh, obviously we need this, yeah. Yes, we do. So anything else to add, Phil? No, I think, I think we've covered a lot of ground and I think at this point everyone might be reeling a bit. Of course for people to to come and have a look PKL hyphen lang.org there's there's communities sprouting up so so Google for for pickle things and and that. I've really enjoyed the reception because launching new stuff can go in one of two ways and so far this has been an absolute joy and and to see what people do with it is is great. Yeah, I'm sure there's a lot of thank you for doing this. You're making my life easier.

1:11:17 There's a lot of that and and like a Bunch is former colleagues because they used it before and they know about it and they were they were looking for it to be published. And then a bunch is people who'd never heard of it before, who have no connection to any of these people. And then just sort of stumbled across it and went, oh, this looks fun. And are you looking at, I don't know, community building, the process of doing that, because you know that can without some care, you can. We definitely are. So we the main the main community that we build is is on our GitHub. So we try to be very responsive to to discussions. We try to be receptive and and when things you know are reasonable requests but won't line up with us then we try to be receptive of contributions and to make that clear and touch and and we do engage with with community sometimes where they are. So we do, we do, you know code reviews and we and we have chats and stuff.

1:12:18 There's a community Discord, so you know, there's there's there's things that we that that we hang out with, but also there's already a bunch of users that that know what they're talking about. So it it seems to also grow naturally, which I'm very happy. About and I in my experience with with you all the maintainers in the community it's been really positive and I've asked the the dumb questions and been greeted with kindness and and yeah that's that's it's felt good to to be part of that community and and I certainly appreciate your all's responsiveness your and the team's responsiveness to my questions and and my you know bug filings and you know all that kind of stuff. I feel like it's it's you've you've all done a great job of kind of stewarding the the community and and my interactions with you. So thank you.

1:13:11 And the core team, the three of you, is this all you're doing or do you have other work as well? I mean I there's there's generally like other style work in in terms of so I I help people hold it right as well so so that's that's quite a bit of time to to sort of design review and stuff and like oh we want to build a system like this can you look at that and which is essentially building pickle but it's it it does mean that there's a lot of like other technical work that that happens which takes a lot a lot of time sure. But your focus is all on. But the core focus is is is very hard on on pickle. Yeah. And and in that regard, it has been very easy for the team to be quite kind and receptive on the get up stuff because people finding bug reports is sort of exactly what we were hoping for and it has massively accelerated what we do.

1:14:10 So you know we're doing it for selfish reasons, is what I'm saying. That's right. Yeah. Yeah. It works in both for both, both parties. Awesome. Well, thank you so much for joining us, Phil. Look forward to very bright future with pickle and thanks for for teaching us all about it. A pleasure and a delight.