Fork me on GitHub

Comparison between SARL and Other Languages

Java, Xtend and Scala are object-oriented programming languages. As SARL, Xtend is based on the Xtext libraries for compiling to the Java language.

The main features coming from the Java language are supported by SARL too. The following table provides the major differences between the SARL, Java, Xtend and Scala languages, excluding any feature provided by the development environment (Eclipse, IntelliJ…)

</tr> </tbody></table> ##1. References This documentation is based on elements from the following sources: * [Xtend](https://www.eclipse.org/xtend/documentation.html) * [Xtext](https://www.eclipse.org/Xtext/documentation.html) * [Java Tutorials](https://docs.oracle.com/javase/tutorial/) * [Scala Home Page](https://www.scala-lang.org/) ##2. Legal Notice * Specification: SARL General-purpose Agent-Oriented Programming Language ("Specification") * Version: 0.10 * Status: Stable Release * Release: 2019-10-26 > Copyright © 2014-2019 [the original authors or authors](http://www.sarl.io/about/index.html). > > Licensed under the Apache License, Version 2.0; > you may not use this file except in compliance with the License. > You may obtain a copy of the [License](http://www.apache.org/licenses/LICENSE-2.0). > > You are free to reproduce the content of this page on copyleft websites such as Wikipedia. Generated with the translator io.sarl.maven.docs.generator 0.10.0.
SARLJavaXtendScala
Agent-oriented programming
Agent, Capacity, Skill, Behavior... Yes No No Partial: actor paradigm
Object-oriented programming
Definition of class and interface types Yes Yes Yes Yes
Object-oriented enumeration No, only constants could be defined Yes, constants and functions could be defined No, only constants could be defined Yes, constants and functions could be defined
Definition of annotation types Yes Yes Yes Yes
Definition of static constructors Yes Yes No See companion object
Inheritance of constructors Yes No No No
Automatic creation of read-only data structure Manual with @Data annotation No Manual with @Data annotation No
Automatic creation of getters and setters Manual with @Accessors annotation No Manual with @Accessors annotation Yes
Automatic creation of final-field constructor No No Manual with @FinalFieldsConstructor annotation No
Automatic creation of equals() and hashCode() Yes No Manual with @EqualsHashCode annotation Yes, see case class
Automatic creation of clone() when cloneable type Yes No No Yes
Automatic creation of a serialVersionUID field when serializable type Yes No No Manual with @SerialVersionUID
Automatic creation of the toString() function. Manual with @ToString annotation No Manual with @ToString annotation Yes, see case class
Functions, Procedures and Operators
Definition of dispatch functions Yes No Yes No
Extension methods Yes No Yes Yes
Definition of variadic functions Yes Yes Yes Yes
Definition of default values for the formal parameters Yes No No Yes
Operator overloading (except assignment and casting, see below) Yes No Yes Yes
Cast operator overloading Yes No No No
Assignment operator overloading No No No No
Automatic detection of pure functions and marking Yes No No No
Expressions
Definition of lambda expressions Yes Yes Yes Yes
Inference of types Yes No Yes Yes
Support the break statement Yes Yes No Yes
Support the continue statement Yes Yes No Yes
Implicit typecasting between number values, including AtomicInteger, AtomicLong, AtomicDouble, BigInteger, and BigDecimal Yes Partial: primitive to primitive types, primitive to object wrapper types, and object wrapper to primitive types Partial: primitive to primitive types, primitive to object wrapper types, and object wrapper to primitive types Yes
Arithmetic operations with any type of number as operand, including AtomicInteger, AtomicLong, AtomicDouble, BigInteger, and BigDecimal Yes Partial: primitive and wrapper types Partial: primitive and wrapper types Yes