Changes in 0.15.0
Release date: 2025-09-09.
Major Changes
Number of major changes: 4
Generation of implicit event constructors
In SARL, events are fundamental constructs for agent communication, often requiring explicit constructor definitions to initialize their fields. Prior to this change, developers had to manually define constructors for every event, even when the event’s structure was simple or followed a predictable pattern. This manual process introduced several inefficiencies:
- Repetitive constructor definitions for events with standard field initializations.
- Manual constructor writing increased the risk of inconsistencies or omissions, especially in large codebases.
- Developers spent unnecessary time on repetitive tasks, detracting from core logic implementation.
To streamline event definition and improve developer productivity, SARL introduced automatic constructor generation for events. This feature:
- Infers Constructors from Field Declarations:
The compiler automatically generates constructors based on an event’s declared fields, eliminating the need for manual implementation.
Example:
event MyEvent {
var description : String
var payload : double
}
The SARL compiler now automatically generates constructors that are equivalent to the following SARL code:
event MyEvent {
var description : String
var payload : double
new (description : String = null, payload : double = 0.0) {
this.description = description
this.payload = payload
}
}
Space API outside the Janus SRE
In earlier versions of SARL, the Space Implementation API was tightly coupled with the Janus SRE (SARL Runtime Environment). This design choice introduced several limitations:
- The API’s integration within SRE-specific code restricted its reusability in alternative runtime environments or custom implementations.
- Developers could not leverage the Space API independently of SRE, limiting the portability of agent-based systems.
- Changes to the SRE could inadvertently affect the Space API, complicating updates and extensions.
These constraints hindered SARL’s goal of providing a generic, modular, and runtime-agnostic agent programming framework.
To address these issues, the Space Implementation API was moved from the SRE codebase to the SARL SDK.
The Space API is now part of the SARL standard library, making it independent of any specific runtime environment.
The API was redesigned to rely on abstract interfaces and runtime-agnostic contracts, ensuring compatibility with any SARL-compliant environment. Key abstractions, such as Space and SpaceSpecification, are now defined in the SARL SDK, while concrete implementations (e.g., SRE-based) are provided as plugins or extensions.
Existing SRE-based applications continue to function seamlessly, as the SRE now implements the generic Space API rather than defining it.
Library for creating agent working memory
Agent-based systems often require temporary storage and efficient manipulation of data during their execution, particularly for tasks such as reasoning, decision-making, or maintaining contextual state.
Prior to this change, SARL lacked built-in utilities for managing such short-term data structures. Developers had to rely on ad-hoc solutions—such as custom collections or external libraries.
SARL 0.15 introduced a simple “working memory” utility toolset. The working memory utilities are directly accessible within agent behaviors with the WorkingMemory
capacity, enabling seamless interaction with other SARL constructs. A default skill is provided for implementing the WorkingMemory
capacity based on data structure that maps knowledge names (or identifiers) to their values.
Robust Type Checker for Type Parameters
SARL supports generic constructs, such as parameterized events, to enable flexible and reusable agent-based systems. However, prior to the recent update, SARL’s type checking mechanism—built on the Xtext framework—lacked robust validation for type parameter conformance. This limitation led to several challenges:
- Insufficient compile-time validation of type parameters could result in undetected type mismatches, manifesting as runtime exceptions.
- Developers could not fully leverage advanced generic programming features, such as bounded polymorphism or variance annotations, due to the absence of a dedicated type conformance checker.
To overcome these limitations, SARL implemented a dedicated type checker that builds upon the existing Xtext framework. This enhanced checker ensures that generic type arguments adhere to their specified bounds (for example, T extends Number
). Additionally, it validates conformance in subtype hierarchies and enforces correct type relationships within inheritance chains and interface implementations, including complex scenarios.
Detailed Changes
1. SARL Language
1.1. SARL Language and Grammar
- Add the automatic generation of events’ constructors. [more details]
- Accept different syntaxes for the specification of a main function in a class. [more details]
- Remove references to protocol features in the SARL metamodel. [1, 2, 3]
1.2. SARL Validator
- Implementation of a robust type checker for type parameters’ conformance. [more details]
- Ensure singleton for the provider of configurable issue severities. [more details]
1.3. Java Model Inferrer
- Enable the generation of multiple Java files from a single SARL construct. [more details]
- Introduce fragments in the code of the
JvmModelInferrer
for enabling eaiser extension and specialization of the inferring process. [1, 2]
- Avoid Null Pointer Exception when the supertype of a event in unspecified in the compiled code. [more details]
1.4. Programmatic Code Builder
- Code builder includes new function that take JVM type references as arguments in addition to the String names. [more details]
- Regenerate the code builders for SARL for fixing the support of type parameters. [1, 2]
- Avoid to create multiple
XBlockExpression
when calling the getter function of the code builder. [more details]
- Avoid NPE when retreiving the resource from an expression builder. [more details]
- Add tests of the support of type parameters by the code builders [more details]
1.5. Third-party Syntax Color Style
- Add configuration expansion macros in the SARL’s TeX style for specifying font size of the SARL code. [more details]
- Add the library for creating an agent “working memory”. [more details]
- Move the space implementation API from the SRE code to the SARL API to be more generic and SRE-independent. [1, 2]
- Add the function
injectMembers(Object)
in the SRE
utility class to enable to inject the SRE-dependent objects. [more details]
- Add the class
MutableOptional
. [more details]
3. Eclipse Products
- Avoid duplicate source folders when SARL and project extension have the same folders. [more details]
- Decrease the memory footprint for the SARL image provider. [more details]
- Fixing the implementation type of the default SARL editor in the plugin definition. [more details]
- Remove uncessary event constructors from the embedded examples. [more details]
- Remove references to protocol features in the standard SARL UI and Eclipse plugins. [1, 2]
- Use of the new code builder API in the Eclipse wizard when generating SARL files. [more details]
- Disable the warning related to the usage of javax inject annotations. [more details]
4. Janus Run-time Environment
- Add the function
injectMembers(Object)
in the SRE
utility class to enable to inject the SRE-dependent objects. [more details]
- Upgrade to Bootique 3.0-RC1. [more details]
- Fixing the name of the integration tests in the code repository. [more details]
5. Maven Compiler Plugin
- Add a configuration parameter in the Maven compiler plugin for specifying the issue severities in the POM file. [more details]
6. SARL Documentation
- Refactoring of the structure of the official documentation for making it easier to read. [1, 2]
- Extension of the documentation of the keywords
this
, super
, it
and occurrence
. [more details]
- Update the documentation related to the automatic generation of the event constructors. [more details]
7. For SARL Contributors
- Upgrade major libraries:
- Create the
uiextensions
and eclipseextensions
modules for helping the extension of the SARL IDE by third-party modules. [1, 2]
- Add
fileGen
functions in the testing API for SARL projects. These functions enables to obtain an EObject
instance from a SARL code. [more details]
- Fixing unit tests in the compiler module because of the upgrade of the version of Jupiter Junit. [more details]
- Fixing variable definition in the developer’s launching scripts for the SARL IDE. [more details]
- Update the versions of the plugins in the Maven extension specifications. [more details]
- Change copyrights in file headers. [1, 2]
- Add missed tests for the generic event serialization. [more details]
- Add missed tests for generic event formatting. [more details]
- Fixing invalid carriage-return character for Windows OS. [more details]
- Fixing the deployment configuration. [more details]
- Fixing the Powershell script for CI. [1, 2]
- Enable CI on multiple OS. [more details]
8. Changes in the Previous Versions