Release date: 2021-05-27.
Number of major changes: 4.
SARL allows you to specify a default value for a formal parameter of a function or a constructor. When a default value is specified, it means that the caller of the action can skip passing a value for the corresponding argument. And, when the function is called, the default value is given to the skipped argument.
Up to the version 0.11 of SARL, the expressions that constitute the default values must reference static or constant expressions, and these features must not have border effect.
Since the version 0.12 of SARL, the first restriction is no more applied. Consequently, the default value expression could reference either static and instance features (1, 2). The constraint on the feature’s border effects is still valid.
For example, the following code is valid in SARL:
agent A {
var aField : int
def aFunction(p : int = aField) {
}
}
It means that the value of the p
parameter is the value of the aField
field when the aFunction
function is invoked.
The abstract
modifier is added into the list of the accepted modifiers for a SARL event (details). For example, the following code defines an abstract event with name A
:
abstract event A
An abstract event is an event that cannot be instantiated, but it can be derived. When an abstract event is derived, the subtype usually provides constructors that are compatible with the super type’s constructor.
In SARL, as for the Akka actor framework, there is an important distinction between failures and validation errors:
In order to make the agent able to react to failures, the SARL API defines a specific event that is representing any failure or validation error that the agent could handle if it is interested by: Failure
.
Each time an agent needs to be notified about a fault (into its agent tasks for example), an occurrence of this event type is fired in the internal context of the agent.
Several failure events are pre-defined in the SARL API:
AgentKillFailure
: when the agent killing cannot be realized (the major cause of a killing failure is the fact that the agent to be killed contains sub-agents).TaskFailure
: when an agent task (managed by the Schedules
capacity) has failed.Also, the AgentKilled
event has been updated in order to provide the cause of the agent’s killing.
Finally, the SARL API provides tools for propagating failures in the hierarchy of agents, to the parents and to the children.
The multi-agent system is composed of multiple elements, including agents, behaviors, contexts and spaces, but not limited to. Organizational models in multi-agent systems usually position agents as actors-observers within environments shared by multiple agents and organizational structures at different levels of granularity. Then, the agents may have the capacity to observe the environment and the other agents, without directly interacting with them. The observing agent is able to extract information from another agent or from a society of agents, that could be opaque according to a possible holonic architecture of the system.
Observation means that data or information could be extracted from the observed object without filtering from this latter. The observer is not intrusive from the agent point of view. In other words, the observed agent has no knowledge about the fact it is observed or not. In this case, it cannot adapt its behavior on its observation status.
An observation mecanism was defined into the Janus SRE. Since the version 0.12 of SARL, this observation mecanism is moved into the SARL SDK and transformed as an API that is independent to the SRE (1, 2, 3). In the same set of commits, the naming service for the multiagent system components has been moved from the Janus SRE to the SARL DSK.
Because an agent is defined as an autonomous entity, the agent is supposed to be able to specify if a part of itself is observable or not, i.e. to specify the access rights to its fields. The concepts of “observable” and “not observable” field are introduced in SARL 0.12 (1, 2).
This observability flag could be defined statically by annotating the observable field, or one of its enclosing type, with the @Observable
annotation. The second method is to implement a dedicated agent skill implementing the capacity FieldAccessValidationCapacity
that enables the agent to manage the access rights to its fields dynamically.
abs
,acos
, cos
, asin
, sin
, atan
, atan2
, cbrt
, ceil
, compare
, compareTo
, cosh
, empty*
, exp
, floor
, hypot
, log
, log10
, log1p
, max
, min
, pow
, random
, rint
, round
, signum
, signh
, sqrt
, tan
, tanh
, ulp
.toString(JsonBuffer)
was marked as pure but it has border effects. The Pure
annotation is removed from the function (details).Annotation
, Boolean
, Byte
, Character
, Clock
, Double
, Duration
, Event
, Float
, Instant
, Integer
, LocalDate
, LocalDateTime
, Long
, MonthDay
, OffsetDataTime
, OffsetTime
, Pair
, Period
, Permission
, Short
, Year
, YearMonth
, ZoneDataTime
, ZoneId
, ZoneOffset
.@Data
annotation is implicitly considered as immutable (details).UUID
. The SARL compiler is able to do an automatic conversion from a string of characters to UUID
, and from an UUID
to a string of characters (details).@SarlAsynchronousExecution
into the language API in order to help the SARL editor to show up the calls to functions that are run asynchronously (details). This annotation has no effect at run-time by itself. It is only a marker for the SARL code editing purpose.@IssueOnCall
by @ErrorOnCall
, @WarningOnCall
and @InfoOnCall
(details). These annotations are used by the SARL compiler for generating an error, warning or information message when the annoted feature is invoked.occurrence
is considered as an immutable object (details).on
behavior units in a Java program. The original event dispatching mechanism (that becomes the default mechanism) is based on Java reflection. For each on
behavior unit, an hidden Java method is generated. This method is called by reflection when an event should be dispatched.null as Type
(details).@Injectable
for types for which fields should be injected according to the inversion of control design pattern. This annotation is automatically added by the SARL compiler when the @Inject
annotation is found into a type declaration (details). This annotation may be used by the SRE for managing the injection of the objects when it is needed.@Accessors
annotation for adding the variadic parameter marker (...
) to the setter functions when it has been found in an inherited prototype (details).register
in the Space
type, and provide the functions registerStrongParticipant
and registerWeakParticipant
(details). These functions permit to make a difference between a strong participant and a weak participant. A space could be destroyed only if there is no more strong participants inside. If a space has only weak participants, it could be destroyed.getUUID
to getID
accross the entire API (details).@DefaultSkill
annotation (details). This creator generates a NPE whatever the capacity or skill.SREBootstrap
provides tools for starting the SARL run-time environment programmatically. Several functions were added in this interface for starting the run-time environment as it is started from the command-line (details): setCommandLineArguments(String[])
, startWithoutAgent(boolean)
.Address
and SpaceID
(details).\ignorespaces
at the end of the macro\code
(details).maven.test.skip
: it is an environment variable that is already know for Maven plugins. maven-sarl-plugin disables all the tests when this variable is set to true
.sarl.test.skip
: same effect as maven.test.skip
.sarl.compile.skip
: when this environment variable is set to true
, maven-sarl-plugin does not run the JVM element generator, SARL validator on the SARL source code, and does not run the Java compiler on the generated Java code.sarl.jvminferrer.skip
: when this environment variable is set to true
, maven-sarl-plugin does not run the JVM element generator, SARL validator on the SARL source code. The other components of maven-sarl-plugin are run, e.g. the Java compiler.sarl.clean.skip
: when this environment variable is set to true
, maven-sarl-plugin does nothing at cleaning stage.All these environment variables must be defined from the shell command line, or with the -D
option of the maven tool.
isRootContext()
into the AgentContext
type in order to determine if the agent context is the root context or not (details).Behavior
type permits to specify an agent behavior. The life-cycle of a behavior is enhanced in order to have callbacks when the behavior is installed into and uninstalled from its agent (details):
Behaviors
capacity. Then, the protected function install()
of the behavior itself is invoked.on Initialize
handlers of the behavior are activated.Behaviors
capacity. Then, the on Destroy
handlers of the behavior are activated.uninstall()
of the behavior is invoked.wake
functions for waking up a specific agent behavior that is passed as argument (details). These functions enable to provide an event to a specific behavior, and this event it provided neither to the other behaviors nor the agent itself.Skill
type permits to specify an agent skill. The life-cycle of a skill is enhanced in order to have a callback when a skill is installed into its agent (details). This callback function may be defined and provided by the SRE’s implementation in order to react to the installation of a skill into an agent.getDefaultParentID
, getDefaultParentScope
, emitToParent
.spawnWithID(type, id, parameters)
in the Lifecycle
capacity in order to spawn an agent with a given identifier into the default context (details). This function complements the existing function spawnInContextWithID(type, context, id, parameters)
that needs to give the receiving agent context and the identifier.killMe(cause)
function takes the cause of the agent killing. Before SARL 0.12, this reason must be of type Throwable
, that indicates the cause is an error. Since SARL 0.12, the cause of the killing becomes of type Object
(details). It enables to provide a killing cause that is not an error from the computer programming point-of-view.getInnerDefaultSpace
into the InnerContextAccess
capacity (details). This function is an helper for obtaining the default space of the inner context of the agent.join
function from boolean
to AgentContext
(details). The agent is now able to access the joined agent context directly after joining it.NameScheme
enumeration in order to add new schemes from API extensions (details).io.sarl.api.bootiquebase
(details) that provides the abstract types for implementing a bootique-based application. Bootique is a library for launching and configuring an application.uses
for the relevant capacities that are providing the missed method (details).@SarlAsynchronousExecution
annotation.f(a : int, b : String)
is defined, and in your code you have the call f(5, "a")
, then this call will be displaye by the editor as f(a:5, b:"a")
in order to show the names of the arguments to you.eclipse-slf4j
module (details).-D
definitions from the command-line (details).@DefaultSkill
annotation (details). This creator generates a NPE whatever the capacity or skill.@Injectable
annotation that is supported by the SARL compiler, the Janus SRE is updated in order to inject objects when they are annoted with @Injectable
. If they are not annoted, the objects are created without injection in order to obtain a faster run (details).BuiltinCapacitiesProvider
(details).neverReturn
function is changed in order to make its argument mandatory (details).TaskFailure
event when a background task has thrown an exception (details).toString
function for the executor services (details).AgentLife
is refactoring in order to avoid the receiving of events before the initialization stage is finished (1, 2).Lifecycle
service (details).AgentSpawnFailure
occurrence when an agent spawn cannot succeed (details).getScopedParticipants
in the event space in order to be used by extensions of Janus, e.g. the networking module (details).io.janusproject.eclipse
from the classpath of the applications when they are launched in the Eclipse SARL environment (details).janus
command line tool (details).CannotSpawnException
(details).The service-based architecture of the Janus SRE enables to provide specific services for running SARL agents. The version 0.12 of SARL introduces a service for the communication over a computer network of different instances of the Janus SRE.
By default, Janus does not provide a support for exchanging events over a computer network. If you would like to have benefit of this feature, you should use the extension module, named “Janus Network”, that is introduced in SARL 0.12 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34). The implementation of this module is based on the Hazelcast library in order to build the clusters of Janus nodes.
Thanks to its implementation, the network service has the following major properties:
io.sarl.maven.bootiqueapp
in order to separate the Bootique-based library for building applications, and the SARL batch compiler library (details).--generatemarkdownhelp
to the Maven bootique library (details). This option will be available to all the bootique-based applications, e.g. janus
and sarlc
.SARL_DOC_CURRENT_FILE
and SARL_DOC_CURRENT_FOLDER
that contains the parsing documentation file and its folder (details).-D
parameters (details)-D
parameters (details).volatile
keyword (details).on Initialize
(details).janusnode
tool (details).@Generated
annotation that is different between Java 8 and 11 (details).Utils
class into the “lang-core” plugin and the “lang” plugin (details).