August 5th, 2024

KCL, a constraint-based functional language for configuration

KCL is an open-source programming language for configuration and policy management, featuring a static type system, strong immutability, high scalability, and native integration with OpenAPI and Kubernetes CRD.

Read original articleLink Icon
KCL, a constraint-based functional language for configuration

KCL is an open-source programming language designed for configuration and policy management, emphasizing constraint-based records and functional programming. It draws inspiration from languages like Python and Golang, offering rich features and powerful integrated development environments (IDEs). KCL supports schema-centric configuration types and modular abstractions, enabling users to define configurations, models, functions, and rules effectively. The language ensures stability through a static type system and strong immutability, while its scalability is enhanced by an automatic merging mechanism for isolated configuration blocks. KCL also facilitates high-performance automation with CRUD APIs and multilingual SDKs, making it suitable for modern cloud-native applications. It natively supports API specifications such as OpenAPI and Kubernetes CRD, allowing for seamless integration into existing projects. The language includes features like lambda functions and rules to enforce environmental consistency, ensuring that configurations adhere to defined constraints. KCL is positioned as a production-ready tool for developers looking to manage complex configurations and policies efficiently.

- KCL is an open-source programming language focused on configuration and policy management.

- It features a static type system and strong immutability for stability.

- The language supports high scalability and automation through various tools and SDKs.

- KCL integrates natively with popular API specifications like OpenAPI and Kubernetes CRD.

- It includes functionalities such as lambda expressions and rules for maintaining configuration consistency.

Link Icon 5 comments
By @from-nibly - 5 months
> KCL's automatic merge mechanism for isolated configuration blocks promotes high scalability.

This part scares me a bit. How does it merge? In cuelang, everything has to agree otherwise it's an error. If KCL has a situation where one file can override another, I'm out. That gets way too hairy way too fast.

Edit:

    data0 = {id: 1} | {id: 2}  # Error:conflicting values between {'id': 2} and {'id': 1}
    data1 = {id: 1} | {id = 2}  # Ok, the value of `data` is {"id": 2}
There are the foot guns
By @hosh - 5 months
There was that other long thread about using a general purpose language to generate Kubernetes manifests. However, just looking at this briefly, this may have all the features I care about from general-purpose languages.

Although it looks like it is a better replacement for HCL (Terraform), I'm thinking this may end up working better than Helm.

By @jiggawatts - 5 months
Comparison with YAML, Jsonnet, HCL, CUE, Dhall, Nickel, Helm, etc... here:

https://www.kcl-lang.io/docs/user_docs/getting-started/intro...

By @evanjrowley - 5 months
How does this compare with Nickel?
By @jeffrallen - 5 months