Update page 'Future AerScript Versions'

2019-05-16 11:57:29 +02:00
parent 2d46d449f8
commit d7de444aa7

@@ -2,7 +2,6 @@
This document describes an ideas for future versions of __Aer__ language specification This document describes an ideas for future versions of __Aer__ language specification
* Namespace support * Namespace support
* Operator overloading
* Transient fields * Transient fields
* Variadic methods * Variadic methods
@@ -14,13 +13,14 @@ A right associative \** operator can be added to support exponentiation, along w
printf("2 ** 3 ** 2 = %d\n", 2 ** 3 ** 2); // 512 printf("2 ** 3 ** 2 = %d\n", 2 ** 3 ** 2); // 512
### Operator overloading ### Operator overloading
It should be possible to redeclare or overload most of the built-in operators available in AerScript. Overloaded operators are functions with special names the keyword operator followed by the symbol for the operator being defined. similar to any other function, an overloaded operator has a return type and a parameter list.
class Box { class Box {
public float $breadth; public float $breadth;
public float $height; public float $height;
public float $length; public float $length;
operator +(Box $box1, Box $box2) { object operator+(Box $box1, Box $box2) {
object $box = new Box(); object $box = new Box();
$box->breadth = $box1->breadth + $box2->breadth; $box->breadth = $box1->breadth + $box2->breadth;
$box->height = $box1->height + $box2->height; $box->height = $box1->height + $box2->height;