Skip to content

Releases: ballerina-nutcracker/ballerina

v0.6.0

Choose a tag to compare

@github-actions github-actions released this 05 Aug 08:34
c5ce6e6

🎉 Milestone 6 Release: Ballerina Nutcracker

This milestone adds server-side HTTP, seven new standard library modules, a bal build command, and language subset 9.

🌐 HTTP service support

The headline feature: ballerina/http can now serve traffic, not just call it.

  • http:Listener with declarative attachment or programmatic attach / detach
  • Resource functions for all methods, with typed path parameters ([int], [string], [boolean], [decimal]) and rest paths
  • ListenerConfigurationhost, timeout, httpVersion (HTTP/2 by default, serving both HTTP/1.1 and HTTP/2), secureSocket
  • TLS and mutual TLS; graceful stop that drains in-flight requests
  • Automatic 404 for unmatched paths, 405 for the wrong method
import ballerina/http;

service /api on new http:Listener(9090) {

    resource function get greeting/[string name]() returns http:Response {
        http:Response resp = new;
        resp.setTextPayload(string `Hello, ${name}!`);
        return resp;
    }

    resource function post item() returns http:Response {
        http:Response resp = new;
        resp.statusCode = 201;
        resp.setJsonPayload({status: "created"});
        return resp;
    }
}

Not in this cut: resource functions return http:Response, error, or () — bare string/anydata returns and status-code response types are not yet supported, and there is no http:Caller, parameter binding, or @http:ServiceConfig style configuration.

On the client side: compression negotiation, proxy support, responseLimits, poolConfig, the forward action, a Request class and Method enum, plus payload setters, header mutators, and query-parameter accessors.

🚀 Language features (subset 9)

Annotations — declarations and attachments (marker, repeated, source-only), values from constant and runtime expressions, and annotation access:

type Info readonly & record {| string label; |};

annotation Info runtimeInfo on type;

@runtimeInfo {label: "person"}
type Person record {| string name; |};

Info? value = Person.@runtimeInfo;

Template expressions — string templates are new, and XML templates gained interpolation in content and attributes:

string name = "world";
io:println(string `Hello, ${name}!`);                 // Hello, world!
io:println(xml `<greeting>Hello, ${name}!</greeting>`);

Concurrency — the lock statement and isolated module-level variables:

isolated int counter = 0;

isolated function bump() returns int {
    lock {
        counter += 1;
        return counter;
    }
}

Query expressions — the group by and collect clauses:

var grouped = from var x in xs group by x select [x];
int[] all = from var x in xs collect x;

Also in subset 9:

  • Services & objects — module listener and service declarations, resource methods and resource access actions (f->/path/["a"]/[1]()), service/readonly/distinct class qualifiers, object type inclusion
  • Types — distinct error and object types, typedesc support, stream values backed by user-defined iterators
  • Expressions — spread members in list constructors, foreach over XML, XML equality
  • Language libraries — new lang.float (full math surface), lang.decimal, lang.boolean, lang.object; base64/base16 on lang.array; toBytes/fromBytes on lang.string; cloneWithType and fromJsonWithType on lang.value

📚 Standard library

Seven new modules, plus file I/O for ballerina/io:

Module What it covers
crypto Hashing, HMAC, password hashing (BCrypt, Argon2, PBKDF2), AES, RSA and ECDSA, key loading
io Whole-file read/write for strings, lines, bytes, JSON, and XML
log printDebug / printInfo / printWarn / printError with structured key-value pairs
math.vector Norms, dot product, cosine similarity, Euclidean and Manhattan distance
os Environment variables, user info, subprocess execution
random Cryptographically secure random values
time UTC and civil time, IANA time zones, RFC 3339 / RFC 5322, duration arithmetic
url Percent-encoding and decoding across several charsets
import ballerina/crypto;
import ballerina/io;
import ballerina/log;
import ballerina/time;

public function main() returns error? {
    time:Utc now = time:utcNow();
    check io:fileWriteJson("stamp.json", {at: time:utcToString(now)});
    json content = check io:fileReadJson("stamp.json");
    io:println(content);

    byte[] digest = crypto:hashSha256("hello".toBytes());
    log:printInfo("digest computed", length = digest.length());
}

🛠️ CLI & tooling

Two new commands round out the CLI:

Command Description
bal pack [<package-dir>] Build the .bala distribution archive of a package
bal build [<package-dir>] Build a standalone executable that bundles the Ballerina runtime

bal build produces a self-contained binary at target/bin/<package-name> (override with -o), and cross-compiles to any supported platform with --target-os / --target-arch:

bal build hello
bal build hello --target-os linux --target-arch arm64

Release binaries are published for linux/amd64, linux/arm64, darwin/amd64, darwin/arm64, and windows/amd64.

📦 Projects & packages

  • Standard libraries and language libraries now ship as bundled .bala packages
  • Depend on packages from a local repository, or route resolution through a custom repository
  • Resolve external packages that carry native code

🔍 New diagnostics

The compiler now reports unused local variables, unused import prefixes, returns never functions that can complete normally, and invalid service declarations.

🔗 Resources

v0.5.0

Choose a tag to compare

@github-actions github-actions released this 19 May 14:26
0ab7979

🎉 Milestone 5 Release: Ballerina Native Interpreter

We're excited to announce Milestone 5 — introducing ballerina/http client capabilities and subset 8 language features!

What's included

🌐 HTTP Client Support

Outbound HTTP/HTTPS communication via ballerina/http is now supported:

  • Configuration of http:Client with timeouts, redirects, HTTP versions, and security settings
  • Support for standard methods: get, post, put, patch, delete, head, and execute
  • Response processing via http:Response (headers and JSON, text, or binary payloads)
  • Utility for parsing HTTP headers with http:parseHeader

Example:

import ballerina/http;
import ballerina/io;

final http:Client apiClient = check new ("https://httpbin.org/", {
    timeout: 10
});

public function main() returns error? {
    http:Response res = check apiClient->get("/get?text=Hello%20Ballerina");
    io:println("GET Response Status: ", res.statusCode);
    io:println("GET Response Payload: ", check res.getTextPayload());

    json data = {"message": "HTTP client support is now live!"};
    res = check apiClient->post("/post", data);
    io:println("POST Response JSON Payload: ", check res.getJsonPayload());
    io:println("Post Response Content-Type Header: ", check res.getHeader("Content-Type"));
}

🚀 Language Features

Types & Type System

  • Add support for module type definitions and enums
  • Add support for optional record fields and access
  • Add support for mapping constructors
  • Add support for member access expressions
  • Extend support for type casting
  • Support dependently-typed functions with inferred defaults

Functions

  • Add support for included record parameters
  • Add support for rest parameters in methods
  • Add support for isolated functions

Object-Oriented Features

  • Support client and isolated class qualifiers
  • Add support for remote methods and call actions

Control Flow

  • Improve analysis in conditional branches
  • Add support for foreach over iterable objects
  • Extend query expressions with join, order by, and on conflict

Expressions & Operators

  • Add support for XML template namespaces and attributes
  • Add support for bitwise complement and nil lifting

⚙️ Runtime

  • Detect inherent type violations during mutations
  • Enforce read-only propagation for collections
  • Fix float semantics and NaN handling

📦 Projects & Packages

  • Support resolving external packages and repository implementation

📚 Standard Library

  • Expand lang lib support (error, value, string, xml, int)

🛠️ Diagnostics & Quality

  • Improve error reporting and migrate conformance tests

📖 Documentation

  • Document subset 8 language features

🚀 Download or try it directly in the browser!

🔗 Resources

v0.4.0

Choose a tag to compare

@keizer619 keizer619 released this 06 Apr 15:56
ae2382f

🎉 Milestone 4 Release: Ballerina Native Interpreter

We're excited to announce Milestone 4!

What’s included

  • 🚀 Language Features
    • Expressions & Error Handling
      • Add support for error constructor expressions
      • Add support for contextually expected type in error constructor
      • Add support for logical expressions
      • Add support for check / checkpanic expressions
      • Add support for trap expressions
      • Add support for panic statements
    • Functions
      • Add support for lambdas and closures
      • Add support for extern functions
    • Object-Oriented Features
      • Add support for object and class definitions
    • Types & Type System
      • Implement intersection type support
      • Add support for handle type
      • Support default expressions in record type declarations
    • Variables
      • Add support for module-level variables
      • Enforce variable assignment rules
    • Control Flow
      • Add support for match statements with constant patterns
      • Add support for wildcard binding patterns
      • Add support for foreach over map values
    • Query Expressions
      • Add support for query expressions (arrays with let/where clauses)
      • Add support for query expressions on maps
  • ⚙️ Execution & Observability
    • Add support for profiling and viewing interpreter stage time statistics for debug builds
  • 📦 Projects & Packages
    • Add support for multi-module projects
  • 📚 Standard Library
    • Add lang lib support for map
  • 🛠️ Diagnostics
    • Add support for syntax error reporting
    • Improve diagnostic messages
  • 📖 Documentation
    • Add support for documentation parsing
  • 🏗️ Infrastructure
    • Initial support for incremental compilation
    • Implement native Go TOML parser

🚀Download or try it directly in the browser!

It’s encouraging to see external contributors finding the project organically: @f-schnabel @tkuhemiya

🔗 Resources:

Full Changelog: v0.3.0...v0.4.0

v0.3.0

Choose a tag to compare

@keizer619 keizer619 released this 27 Feb 13:56
840d581

🎉 Milestone 3 Release: Ballerina Native Interpreter

We're excited to announce Milestone 3!

What's included:

  • Support for type cast expressions
  • Support for type test expressions
  • Support for shift expressions
  • Support for conditional variable type narrowing
  • Partial support for ballerina/lang.array
  • Partial support for ballerina/lang.int
  • foreach statements (support for list and range expressions)
  • Support for map values
  • Support for record and tuple type descriptors
  • Removed restrictions on numeric literals
  • Diagnostic reporting

Get started:

Download the release zip from the Release page and run Ballerina programs:

Create a new package:

  • Unix/Linux/macOS: ./bal new <path to bal package or file>
  • Windows: bal.exe new <path to bal package or file>

Run the Ballerina package:

  • Unix/Linux/macOS: ./bal run <path to bal file or package>
  • Windows: bal.exe run <path to bal file or package>

Resources:

New Contributors

Full Changelog: v0.2.0...v0.3.0

v0.2.0

Choose a tag to compare

@keizer619 keizer619 released this 13 Feb 09:43
94f6da7

🎉 Milestone 2 Release: Ballerina Native Interpreter

We're excited to announce Milestone 2!

Changes since milestone 1:

  • Support for union type descriptors
  • Support for module level type descriptors
  • Support for type cast expressions
  • Support for binary bitwise expressions
  • Support for singleton types
  • Initial support for static code analysis
  • Initial support for packages

Get started:

Download the release zip from the Release page and run Ballerina programs:

Create a new package:

  • Unix/Linux/macOS: ./bal new <path to bal package>
  • Windows: bal.exe new <path to bal file>

Run the Ballerina package:

  • Unix/Linux/macOS: ./bal run <path to bal file or project>
  • Windows: bal.exe run <path to bal file or project>

Resources:

• Release: https://github.com/ballerina-platform/ballerina-lang-go/releases/tag/v0.2.0
• Subset 2 examples: https://github.com/ballerina-platform/ballerina-lang-go/tree/main/corpus/bal/subset2

Full Changelog: v0.1.0...v0.2.0

v0.1.0

Choose a tag to compare

@keizer619 keizer619 released this 30 Jan 09:30
090db96

Milestone 1 Release: Ballerina Native Interpreter

We're excited to announce Milestone 1! The native interpreter is now operational with a compilation and execution pipeline for Subset 1 of the Ballerina language.

What's Included

  • Core Language Features: integers, booleans, functions, control flow (if-else), loops (while, break, continue), nil type, and I/O
  • Complete Pipeline: parser → AST → BIR → runtime execution
  • CLI Tool: command-line interface for building and running Ballerina programs

Getting Started

Download the release zip and run Ballerina programs:

Unix/Linux/macOS:

./bal run <file.bal>

Windows:

bal.exe run <file.bal>

Example Program

Here's a complete example demonstrating loops, conditionals, function calls, boolean logic, and I/O operations:

import ballerina/io;

public function main() {
    int n = 50;
    int i = 0;
    while (i < n) {
        io:println("F(", i, ") = ", fibonacci(i));
        i += 1;
    }
}

function fibonacci(int n) returns int {
    if (n <= 1) {
        return n;
    }
    int prev = 0;
    int curr = 1;
    int i = 2;
    while (i <= n) {
        int next = prev + curr;
        prev = curr;
        curr = next;
        i += 1;
    }
    return curr;
}

Resources

New Contributors

Full Changelog: https://github.com/ballerina-platform/ballerina-lang-go/commits/v0.1.0