Ballerina 0.975.0 is an iteration for Ballerina 0.970.0, which was released previously. This release has significant improvements to the standard library and IDE support. Apart from that, there are also some improvements made to the language syntax. Introduction of new BALO format has improvements on compilation time as well.
Previously [x .. y]
syntax was used to represents an integer range in a foreach
statement. This syntax is now x ... y
in Ballerina 0.975.0.
Old syntax (0.970.1)
foreach val in [1 .. 5] {
io:println(val);
}
New syntax
foreach val in 1 ... 5 {
io:println(val);
}
The record type definition syntax now requires a record
keyword. The syntax used previously also works on Ballerina 0.975.0, but this will not be supported in future releases.
Old syntax (0.970.1)
type Person {
string name,
int age,
};
New syntax
type Person record {
string name,
int age,
};
The next
statement is renamed to continue
.
Old syntax (0.970.1)
while (i < 5) {
i = i + 1;
if (i == 2) {
next;
}
}
New syntax
while (i < 5) {
i = i + 1;
if (i == 2) {
continue;
}
}
base16
and base64
based literal values are the two types of literal values supported for blob. The base16
type has a base 16 based character sequence and the base64
type has a base 64 based character sequence or padded character sequence.
New syntax
blob a = base16 `aaabcfccad afcd34 1a4bdf abcd8912df`;
blob b = base64 `aaabcfccad afcd3 4bdf abcd ferf =`;
Now variables cannot be shadowed and are required to have unique names. The only exception is in XML namespaces that already have variable shadowing support.
Old syntax (0.970.1)
string name;
type User object {
private {
string name;
}
function setName(string name) {
self.name = name;
}
};
function print(string name) {
}
New syntax
string name;
type User object {
private {
string userName;
}
function setName(string n) {
self.userName = n;
}
};
function print(string n) {
}
- Add capability to read/write fixed signed integer, float, boolean and string values via data IO APIs
- Error handling support for WebSocket service
@http:WebSocketServiceConfig {
path: "/error/ws"
}
service<http:WebSocketService> errorService bind { port: 9090 } {
onError(endpoint ep, error err) {
io:println(string `error occurred: {{err.message}}`);
}
}
- Allow different types of payloads to be used directly with HTTP client actions and response calls. E.g.,
response = clientEP->post("/test", xml `<color>Red</color>`);
response = clientEP->post("/test", { name: "apple", color: "red" });
_ = caller -> respond("Hello World!");
- Improve redirect functionality so that it supports both HTTP and HTTP2
- Support event notification payloads of different content types with WebSub
- HTTP name based virtual hosting support
@http:ServiceConfig {
basePath:"/page",
host:"abc.com"
}
- Improve the HTTP error handler to recover from source connection failure
- Enhance the API to control the circuit breaker status as per user requirements
http:CircuitBreakerClient cbClient = check <http:CircuitBreakerClient>clientEP.getCallerActions();
if (counter == 2) {
cbClient.forceOpen();
}
- Support to build reproducible builds using the lock file.
- HTTP Trace Log Improvements in Composer.
- Add initial indexing support for Language Server.
- Improve Language Server error reporting.
- Add renaming support for variable symbols.
- Signature help support for action invocations.
- Match expression completion support with snippets.
- Completion support for function invocation scope.
- Code action improvements with generate function for undefined functions.
- User repository support.
- Package auto-import support.
- New live templates.
- New code inspections.
- Performance improvements.
- Syntax highlighting improvements.
Bug fixing was conducted as part of multiple release iterations based on the previous Ballerina 0.970.1 release. Please refer to the following GitHub milestones for bug fixes.
You can download the Ballerina distributions, try samples, and read the documentation at https://ballerina.io. You can also visit the Quick Tour to get started. We encourage you to report issues, improvements, and suggestions at the Ballerina Github Repository.