PKL, a new open source programming language from Apple

pkl

PKL the new Apple programming language

Recently the news broke that Apple has released a new open source “embedded configuration language”, with the mission of facilitating configuration tasks, regardless of their size or complexity. pkl (pronounced like Pickle) It was introduced in version 0.25 as a language designed around a JSON-like key-value structure, but with innovative features aimed at improving the configuration experience

pkl combines the features of an easy-to-understand declarative language with the advanced functionalities of general purpose languages. The language supports type annotations, classes, functions, computational expressions, conditions, and loops.

About Pkl

pkl can be used to generate static configurations in various formats, such as JSON, YAML, and XML, as well as to create modules to process specific configuration formats in applications of various programming languages. Unlike traditional programming languages, Pkl specializes in configuration, offering an alternative that addresses the limitations found in static formats.

We are delighted to announce the first open source release of Pkl (pronounced Pickle), a programming language for producing configurations.

When thinking about configuration, it is common to think of static languages ​​such as JSON, YAML or Property Lists. While these languages ​​have their own merits, they tend to fall short when the configuration increases in complexity. For example, its lack of expressiveness means that the code is frequently repeated. Additionally, it can be easy to make configuration errors, because these formats do not provide any validation of their own.

- Apple designed PKL with the intention of providing a configuration language that combined simplicity and readability. of static formats with the power and flexibility of general-purpose programming languages. Pkl is intended to be used both to generate static configuration files in various formats and to be integrated as a library into other running applications.

The language provides flexible tools to define conditions and verify the correctness of values, allowing errors in the final configuration to be identified before use in the application.

The principles behind PKL are clear and ambitious:

  1. Guarantee the security: PKL seeks to detect validation errors before deployment, providing an additional layer of security in the configuration process.
  2. Adaptability to Various Use Cases: From the simplest to the most complex tasks, Pkl is designed to accommodate a wide range of configuration needs.
  3. Easy to use: With best-in-class IDE integrations, Pkl strives to be a pleasure to write, providing a smooth and efficient development experience.

pkl is designed to define configurations and promote the configuration model as code, It also introduces a familiar syntax for developers, including features such as classes, functions, loops, and type annotations, making it much easier to adopt and learn, allowing users to focus on configuration logic rather than the complexity of the language itself.

Moreover, It has links to integrate PKL into Java, Kotlin, Go and Swift applications. Additionally, a separate module is proposed for integration with the Spring framework. These bindings allow you to create ready-to-use packages and modules with classes that manipulate the configuration described in the application, based on the configuration in the PKL language. Configuration packages can be published to repositories and imported as dependencies, making it easy to share PKL code between different projects.

For those interested in Pkl, you should know that the Pkl related toolkit is written in Kotlin and released under the Apache license. Plugins for working with code in the PKL language are available for the IntelliJ, Visual Studio Code and Neovim development environments. Additionally, the LSP (Language Server Protocol) driver is expected to be released in the near future.

If you are interested in knowing more about it, you can consult the details In the following link.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.