Update page 'Future AerScript Versions'

2019-05-16 11:54:04 +02:00
parent 1f5dde3418
commit 2d46d449f8

@@ -7,26 +7,24 @@ This document describes an ideas for future versions of __Aer__ language specifi
* Variadic methods
### Data Structures
A data structure is a group of data elements grouped together under one name. These data elements, known as members, can have different types and different lengths. Data structures can be declared in __AerScript__ using the following syntax:
struct data {
string fname;
string lname;
int age;
} $person1, $person2;
struct data $person3;
$person1.fname = 'Martin';
$person1.lname = 'Smith';
$person1.age = 27;
$person2 = {fname => 'Andrew', lname => 'Smith', age => 22};
Structure members can be access by using a dot operator (.). The arrow operator cannot be used because a structure is not an object.
### Exponentiation Operator
A right associative \** operator can be added to support exponentiation, along with a \**= shorthand assignment operator.
printf("2 ** 3 = %d\n", 2 ** 3); // 8
printf("2 ** 3 ** 2 = %d\n", 2 ** 3 ** 2); // 512
### Operator overloading
class Box {
public float $breadth;
public float $height;
public float $length;
operator +(Box $box1, Box $box2) {
object $box = new Box();
$box->breadth = $box1->breadth + $box2->breadth;
$box->height = $box1->height + $box2->height;
$box->length = $box1->length + $box2->length;
return $box;
}
}