Pkl is a new programming language from Apple specifically designed for creating configuration files. Pkl aims to revolutionize how configurations are developed, addressing the limitations of traditional static languages like JSON, YAML, and Property Lists. 

These conventional formats, while useful, often struggle to manage complexity effectively, leading to repetitive code and a higher likelihood of configuration errors due to their lack of inherent validation mechanisms, according to the Pkl team. 

Developers have historically turned to ancillary tools that introduce special logic to handle more complex configuration needs. These tools might offer features like reference resolution to avoid repetition (DRY principles) or provide custom validation methods to prevent errors. However, these enhancements often complicate the formats, making them quasi-programming languages that are difficult to understand and write. 

This makeshift approach to enhancing expressiveness and validation can lead to formats that are neither efficient nor user-friendly. An alternative solution has been to utilize general-purpose programming languages, such as Kotlin, Ruby, or JavaScript, to create Domain-Specific Languages (DSLs) for generating configuration data. However, the configuration can be cumbersome. 

Additionally, adopting a DSL based on a general-purpose language often results in ecosystem lock-in, according to the Pkl team. 

Pkl emerges as a solution to these problems, offering a middle ground that combines the simplicity and focused purpose of traditional configuration languages with the expressiveness and validation capabilities of full-fledged programming languages. By doing so, Pkl aims to simplify the process of creating complex configurations without sacrificing power or flexibility, making it an attractive option for developers seeking efficient and error-resistant configuration management tools.

“We created Pkl because we think that configuration is best expressed as a blend between a static language and a general-purpose programming language. We want to take the best of both worlds; to provide a language that is declarative and simple to read and write, but enhanced with capabilities borrowed from general-purpose languages,” the Pkl team wrote in a blog post. “When writing Pkl, you can use the language features you’d expect, like classes, functions, conditionals, and loops. You can build abstraction layers, and share code by creating packages and publishing them. Most importantly, you can use Pkl to meet many different types of configuration needs. It can be used to produce static configuration files in any format, or be embedded as a library into another application runtime.”