ballerina 1.2.0
Programming languages

The new Ballerina 1.2.0 version is here!

27th April 2020

Just a few months ago, WSO2 released the latest version of Ballerina, the modern programming language that offers a wide array of tools to boost productivity in web development.

What is WSO2 Ballerina?

Most current-day programming languages include libraries that allow for the management of performance, structured data, errors or failures, multiple cores, and other tasks that, thanks to Ballerina, can be executed directly from the computer language, reducing failures in cloud distributed environments.

WSO2 Ballerina is a cloud-native programming language specialized on integration, which includes the best practices in web programming, microservices and DevOps and Agile-oriented development.

All the new features of Ballerina 1.2.0

The new version of Ballerina 1.2.0 is the most important of 2020, given that it includes a set of valuable improvements and features for the users in regard to runtime, the library and tools so that the developers can have a fluid and practical experience when writing integration code.

Below you will find the most important among them: 

  • The stream type has been refined and included in the language specification, and redesigned in the compiler’s implementation. A sequence is a value that is similar to an object that can generate a sequence of values. It offers two primitive operations next and close. The lang library associated with the stream type,, offers additional operations that can be performed in sequence.
  • The query expression offers a query functionality integrated into the language that is similar to SQL syntax. In this latest version, it behaves like lists. In its current form, a query expression can be considered to be a chain of 4 types of clauses: from, let, where and select. A query expression must begin with a from clause and end with a select clause. Between those two clauses you can have zero or more from, let or where clauses. The expression part of the query starting at (and including) the from clause up to the select clause (not included) is called “query channelling”.
  • A query action consists of a query channelling followed by a do clause that contains a set of statements. For each of the input frameworks sent by the query channelling, the set of statements in the do clause is executed with that framework within the scope.
  • The lang library modules can define integrated subtypes for their respective types. This means that these subtypes are defined by the language specification. For example, the module defines the following int subtypes: Signed8, Unsigned8, Signed16, Unsigned16, Signed32y Unsigned32.
  • The XML design has been refined and is no longer included in the preview. The renewed design has a query syntax that is similar to XPath for an easy and safe management of XML data. The associated lang library, lang.xml, has also been improved to complement this design. In addition, XML access is now lax, which means that the compile-time verification is relaxed and moved to the runtime. Accessing a non-existent attribute or using a field access expression in a non-XML element will result in an error. If an optional field access syntax is used, it will return nil instead of an error when the field is not available. Attributes are accessed using a namespace prefix, using the value.prefix:attrName syntax, where the XML prefix must be declared in the scope.
  • The let expression allows for variables to be associated and for the evaluation of an expression with those variables within the scope. The scope of the variables is limited to the let expression.
  • The new version of Ballerina has a disapproval function: users can tag functions or methods, type definitions, constants, etc., as obsolete, which triggers warnings during compilation.

In addition, WSO2 Ballerina 1.2.0 has significantly reduced compile times. Standard library modules also have some noteworthy features and improvements:

  • The HTTP module now accepts HTTP cookies. It introduces new APIs for the management of cookies, both on the server-side and on the client-side.
  • The cache module includes the new Cache API v2. This new implementation allows users to provide personalized cache flushing policies if necessary, and guarantees a significant performance improvement in relation to the previous version.
  • The GRPC module has redesigned its support for fields with the goal of making better use of the features of the Ballerina language: one of the fields is mapped to optional fields in the records, and the map fields are mapped as nested records. 
  • The Kafka module has been updated to version 2.0, bringing very useful changes. This version offers support for personalized serializers or deserializers and Avro.

In addition to all of these major features and improvements, errors and issues related to language specifications in the compiler, as well as in the runtime, have been addressed and resolved.

As for the language, the language implementation is based on stable language specification version 200R1, whose implementation includes a set of functionalities that make integration even easier for the user, in addition to being renewed and improved in relation to the resolution of critical situations of past versions of Ballerina

The new version of WSO2 Ballerina sets the stage for the generation of an even richer set of characteristics and functionalities aimed at simplifying integration scenarios –which are so widespread nowadays– and making them more efficient.

To know the specifics and details about each of the new features and characteristics of version 1.2.0 of Ballerina, get in touch with us and we will answer all of your questions.