- 2201.10.1 (Swan Lake Update 10)
- 2201.10.0 (Swan Lake Update 10)
- 2201.9.4 (Swan Lake Update 9)
- 2201.9.3 (Swan Lake Update 9)
- 2201.9.2 (Swan Lake Update 9)
- 2201.9.1 (Swan Lake Update 9)
- 2201.9.0 (Swan Lake Update 9)
- 2201.8.8 (Swan Lake Update 8)
- 2201.8.7 (Swan Lake Update 8)
- 2201.8.6 (Swan Lake Update 8)
- 2201.8.5 (Swan Lake Update 8)
- 2201.8.4 (Swan Lake Update 8)
- 2201.8.3 (Swan Lake Update 8)
- 2201.8.2 (Swan Lake Update 8)
- 2201.8.1 (Swan Lake Update 8)
- 2201.8.0 (Swan Lake Update 8)
- 2201.7.5 (Swan Lake Update 7)
- 2201.7.4 (Swan Lake Update 7)
- 2201.7.3 (Swan Lake Update 7)
- 2201.7.2 (Swan Lake Update 7)
- 2201.7.1 (Swan Lake Update 7)
- 2201.7.0 (Swan Lake Update 7)
- 2201.6.3 (Swan Lake Update 6)
- 2201.6.2 (Swan Lake Update 6)
- 2201.6.1 (Swan Lake Update 6)
- 2201.6.0 (Swan Lake Update 6)
- 2201.5.5 (Swan Lake Update 5)
- 2201.5.4 (Swan Lake Update 5)
- 2201.5.3 (Swan Lake Update 5)
- 2201.5.2 (Swan Lake Update 5)
- 2201.5.1 (Swan Lake Update 5)
- 2201.5.0 (Swan Lake Update 5)
- 2201.4.3 (Swan Lake Update 4)
- 2201.4.2 (Swan Lake Update 4)
- 2201.4.1 (Swan Lake Update 4)
- 2201.4.0 (Swan Lake Update 4)
- 2201.3.5 (Swan Lake Update 3)
- 2201.3.4 (Swan Lake Update 3)
- 2201.3.3 (Swan Lake Update 3)
- 2201.3.2 (Swan Lake Update 3)
- 2201.3.1 (Swan Lake Update 3)
- 2201.3.0 (Swan Lake Update 3)
- 2201.2.4 (Swan Lake Update 2)
- 2201.2.3 (Swan Lake Update 2)
- 2201.2.2 (Swan Lake Update 2)
- 2201.2.1 (Swan Lake Update 2)
- 2201.2.0 (Swan Lake Update 2)
- 2201.1.2 (Swan Lake Update 1)
- 2201.1.1 (Swan Lake Update 1)
- 2201.1.0 (Swan Lake Update 1)
- 2201.0.5 (Swan Lake)
- 2201.0.4 (Swan Lake)
- 2201.0.3 (Swan Lake)
- 2201.0.2 (Swan Lake)
- 2201.0.1 (Swan Lake)
- 2201.0.0 (Swan Lake)
- Swan Lake Beta6
- Swan Lake Beta5
- Swan Lake Beta4
- Swan Lake Beta3
- Swan Lake Beta2
- Swan Lake Beta1
- Swan Lake Alpha5
- Swan Lake Alpha4
- Swan Lake Alpha3
- Swan Lake Alpha2
- Swan Lake Alpha1
- Swan Lake Preview 8
- Swan Lake Preview 7
- Swan Lake Preview 6
- Swan Lake Preview 5
- Swan Lake Preview 4
- Swan Lake Preview 3
- Swan Lake Preview 2
- Swan Lake Preview 1
- 1.2.54
- 1.2.53
- 1.2.52
- 1.2.51
- 1.2.50
- 1.2.49
- 1.2.48
- 1.2.47
- 1.2.46
- 1.2.45
- 1.2.44
- 1.2.43
- 1.2.42
- 1.2.41
- 1.2.40
- 1.2.39
- 1.2.38
- 1.2.37
- 1.2.36
- 1.2.35
- 1.2.34
- 1.2.33
- 1.2.32
- 1.2.31
- 1.2.30
- 1.2.29
- 1.2.28
- 1.2.27
- 1.2.26
- 1.2.25
- 1.2.24
- 1.2.23
- 1.2.22
- 1.2.21
- 1.2.20
- 1.2.19
- 1.2.18
- 1.2.17
- 1.2.16
- 1.2.15
- 1.2.14
- 1.2.13
- 1.2.12
- 1.2.11
- 1.2.10
- 1.2.9
- 1.2.8
- 1.2.7
- 1.2.6
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
Overview of Ballerina Swan Lake Beta2
This is the second beta release leading up to the Ballerina Swan Lake GA release.
It introduces the new language features planned for the Swan Lake GA release and includes improvements and bug fixes done to the compiler, runtime, standard library, and developer tooling after the Swan Lake Beta1 release.
Updating Ballerina
If you are already using Ballerina, use the Ballerina update tool to directly update to Ballerina Swan Lake Beta2.
First, run the command below to update the update tool to its latest version.
bal update
If your update tool is below version 0.8.14, use the ballerina update
command.
Next, run the command below to update to Swan Lake Beta2.
bal dist pull slbeta2
Installing Ballerina
If you have not installed Ballerina, then download the installers to install.
Language updates
Improvements
-
Introduced the support for recursive tuple types.
type RecursiveType [int, RecursiveType[]]; public function main() { RecursiveType a = [1]; RecursiveType b = [1, []]; RecursiveType c = [1, [a]]; }
-
Changed the static type of the string iteration from
string
tostring:Char
.public function main() { string str = "foo"; foreach string:Char s in str { io:println(s); } record {|string:Char value;|}? next = str.iterator().next(); if !(next is ()) { io:println(next.value); } }
Bug fixes
To view bug fixes, see the GitHub milestone for Swan Lake Beta2.
Runtime updates
Improvements
-
Introduced
configurable
variables of union types via the TOML syntax.configurable map<anydata> myMap = ?; configurable int|string id = ?;
TOML:
id = "12345" [myMap] name = "John" age = 10
Bug fixes
To view bug fixes, see the GitHub milestone for Swan Lake Beta2.
Standard library updates
New features
log
package
Added observability span context values to log messages when observability is enabled.
io
package
Introduced the io:fprint
and io:fprintln
APIs which allow users to print content to a given stream (standard error or standard out).
io:fprint(io:stderr, "Unexpected error occurred"); io:fprintln(io:stderr, "Unexpected error occurred"); io:fprint(io:stdout, "Passed without an error"); io:fprintln(io:stdout, "Passed without an error");
websocket
package
Introduced declarative auth support for the server-side.
websub
package
Added a utility method to retrieve HTTP headers from the websub:ContentDistributionMessage
.
Improvements
Database packages
Made the return type of the stream to be inferred now as a second parameter to the query remote method.
Previous syntax
stream<record {}, error> resultStream = jdbcClient->query(`SELECT * FROM Customers`,Customer); stream<Customer, sql:Error> customerStream = <stream<Customer, sql:Error>>resultStream;
According to the previous syntax, you can give the Customer
record as the expected record type of the stream but you cannot get that stream directly. To do that, you have to cast the returned stream to the expected stream. Therefore, this has been improved to directly access data as an expected record type.
New syntax
stream<Customer, error> customerStream = sqlClient->query(`SELECT * FROM Customers`);
http
package
- Updated to respond with a 202 Accepted response when the resource function returns nil. If the
http:Caller
is used in the resource, then, returning nil from the resource leads to a 500 Internal Server Error response. - Updated to log the error stack trace when an error is returned from the resource function and on connection failures.
- Updated to log a warning when the same request is responded more than one time.
graphql
package
- Made the GraphQL resource execution non-blocking.
- Updated to send a
BAD_REQUEST
status code for the responses with document validation errors.
ftp
package
- Changed the
get
,append
, andput
method APIs to supportstream
instead of usingio:ReadableByteChannel
for reading and writing files. - Updated to support the FTP protocol with password and private key based authentications.
websub
package
- Updated to log the error stack trace when an error is returned from the remote function of the subscriber service.
- Updated to return module-specific errors from the WebSub public APIs.
- Updated to allow non-remote methods in the subscriber service.
websubhub
package
- Updated to log the error stack trace when an error is returned from the remote function of the hub service.
- Updated to return the module-specific errors from the WebSubHub public APIs.
- Updated to allow non-remote methods in the Hub Service.
- Updated to allow
http:Headers
as an optional parameter in specific remote methods (onRegisterTopic
/onDeregisterTopic
/onUpdateMessage
/onSubscription
/onUnsubscription
).
Bug fixes
To view bug fixes, see the GitHub milestone for Swan Lake Beta2.
Code to Cloud updates
Bug fixes
To view bug fixes, see the GitHub milestone for Swan Lake Beta2.
Developer tools updates
New features
Debugger
- Added expression evaluation support for client remote method call actions.
- Added support to show the child element count inline (without having to expand the parent element) for Ballerina structured (i.e., Map, List, Table, XML, and JSON) variables.
Improvements
Bindgen tool
Changed the default bindings mapping approach to generate module-level mappings instead of having to use an explicit flag for this behavior. Generation of single directory mappings is facilitated using the [(-o|--output) <output-path>]
option.
Test framework
- Added support for a map of tuples as the data set for data provider functions.
- Added case-based filtering when running tests against data sets.
Bug fixes
To view bug fixes, see the GitHub milestone for Swan Lake Beta2 of the repositories below.