diff --git a/docs/io.sarl.docs.markdown/src/main/documentation/index.md b/docs/io.sarl.docs.markdown/src/main/documentation/index.md index d5189d6d6a..500882f63e 100644 --- a/docs/io.sarl.docs.markdown/src/main/documentation/index.md +++ b/docs/io.sarl.docs.markdown/src/main/documentation/index.md @@ -74,6 +74,7 @@ * [Assertions](./reference/general/Assertion.md) * Meta-programming: * [Active annotations](./reference/general/ActiveAnnotations.md) +* [Comparison between SARL and other Languages](./reference/LanguageComparison.md) ### Agent-Oriented Programming @@ -88,6 +89,7 @@ ### Object-Oriented Programming * [Basic Object-Oriented Programming Support](./reference/OOP.md) +* [Comparison between SARL and other Languages](./reference/LanguageComparison.md) ## Compilation and Generation Infrastructure diff --git a/docs/io.sarl.docs.markdown/src/main/documentation/reference/LanguageComparison.md b/docs/io.sarl.docs.markdown/src/main/documentation/reference/LanguageComparison.md new file mode 100644 index 0000000000..d2136a1559 --- /dev/null +++ b/docs/io.sarl.docs.markdown/src/main/documentation/reference/LanguageComparison.md @@ -0,0 +1,160 @@ +# Comparison between SARL and Other Languages + +Java, [Xtend](https://www.eclipse.org/xtend/) and +[Scala](http://scala-lang.org/) are object-oriented programming languages. +As SARL, Xtend is based on the [Xtext](https://www.eclipse.org/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...) + +
SARL | Java | Xtend | Scala | |
---|---|---|---|---|
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 | +Yes | +No | +Yes | +Yes |
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 |
SARL | Java | Xtend | Scala | |
---|---|---|---|---|
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 | -Yes | -No | -Yes | -Yes |
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 |