Pkl Programming Language: Apple Unveils Next-Gen Language - Features, Tutorials & Installation Guide

By Vinius M Muthii | February 08, 2024

The amazing thing about technology is the constant and tremendous growth in its dynamics. Currently, there are many programming languages, regardless, Apple has released a new programming language; Pkl(pronounced Pickle). Pkl Team has released its first release of Pkl via open source as version 0.25.1, terming it as a programming language for producing configuration.

In this article, we will cover the dynamics of this new programming language and deduce its impact on our current tech-based world.

'Apple new programming language - Pkl | major-innovations.com'

Pkl Programming Logo

Pkl Overview

Configuration is a wide and important aspect of modern applications. Many programming languages are supporting configurations already in the market like JSON, YAML, and Property Lists. However, as configuration complexity grows in the applications, these languages tend to lack expressivity leading to configuration errors. Furthermore, these languages do not provide any validation of their own hence forcing the programmers to incorporate other tools. This makes configuration setups more complex, and hard to write and understand leading to much time spent on debugging.

Well, the Pkl Team believes that their new product, Pkl is here to solve this menace by expressing configuration as a blend between a static language and a general-purpose programming language. Pkl is a language that is declarative, simple to read and write, and enhanced with capabilities borrowed from general-purpose languages. Some of the benefits that this new programming language aims to render include:

  • You can build abstraction layers, and share code by creating packages and publishing them.
  • You can use the language features you’d expect, like classes, functions, conditionals, and loops.
  • You can use it to produce static configuration files in any format or be embedded as a library into another application runtime.
  • You can catch validation errors before deployment ensuring safety and data privacy.
  • You can scale comfortably from simple to complex use cases.

Key Features of Pkl

Pkl Team has made an effort to make this language familiar to developers and easy to learn by incorporating features like classes, functions, loops, and type annotations.

'Pkl Programming language - Loops and functions | major-innovations.com'

Pkl Code showcasing Loops and functions

However, some of its features stand out well in matters configurations. They include:

1. Built-in Validation

'Pkl Programming language - annotations & validations | major-innovations.com'

Showcasing Validation

The most important configuration aspect is data validation, where the inserted data has to fall into defined aspects. Validation is achieved in Pkl using type annotations. This way, each constraint has clearly defined type annotations that make sure the data entered falls in the required aspects. Example: "age must be between 0 to 150." or "name should not be empty".

2. Sharing Packages

'Pkl Programming Languages - sharing packages & API's | major-innovations.com'

Example snippet showcasing sharing

Pkl provides the ability to publish packages and to import them as dependencies in a project. This way, a developer can create their package, publish them as GitHub releases or anywhere, and then import them via an absolute URL.

3. Language Bindings

Pkl allows you to produce configuration as textual output which can be embedded as a library into other languages. This way, Pkl can be generated as classes/structs in the target language. Currently, Pkl supports Swift, Go Java, and Kotlin. Pkl Teams promises integration with other languages to come by in upcoming versions.

4. Editor Support

Pkl Team has invested a lot to provide best-in-class editor support for developers and programmers. When writing Pkl in an editor, users are guided through the process of filling in configuration data from a given template. The team is also working to incorporate the Language Server Protocol which will provide a similar level of integration in other editors.

IntelliJ plugin which provides rich support for JetBrains editors, like IntelliJ, Webstorm, GoLand, and Pycharm is set to arrive soon for developers. This will enhance features like auto-completion, go-to-definition, and refactoring support. Plugins for both VS Code and neovim are also underway which will provide basic editing features like syntax highlighting and code folding.

Installation and Learning

Pkl has been released on GitHub as an open-source project which is accessible to all. To try it locally, use this installation guide.

To learn more about this new programming language, read through its language reference and take a look at its tutorial here.

In conclusion, the configuration is set to be more simpler and robust with this new programming language. Having been released a few days ago, reviews from developers are yet to be released. Try out this new language to scale up configurations in your applications.

Subscribe to our newsletter and follow our social media channels to get the reviews when they arrive.

Never miss Technological Updates

Subscribe to our Newsletter

By subscribing you agree to our terms and conditions.

Join our Community

Follow us on social media to stay connected and engage with our vibrant tech community: