1. Attributes
Currently if there are several attributes of the same type one would write it like this:
---
rel Points { x: real, y: real }
---
However, there is a more efficient way to write the same declaration without repeating the type name:
---
rel Points { x, y: real }
---
And if there are several attributes, it can be combined like this:
---
rel Points { x, y: real, color: int }
---
Exactly the same approach applies to inline relational type declarations (see below) and to primitive parameters (though I did not merge it with the params branch yet, waiting till it is in the master).
2. Relational Variables
Inline relational type declarations are frequently seen in functions declarations, e.g.:
---
fn GetLogins(): rel { login: string }
{
# ...
}
fn AddUsers(u: rel { name, login: string })
{
# ...
}
---
But these inline types did not work for relational variable declarations. One would need to declare a named relational type first (Point) and then declare a variable, e.g.:
---
rel Point { x, y: real }
chart: Points;
---
With this patch it is now possible to write it like this:
---
chart: rel { x, y: real }
---
Any comments or suggestions?.
- Ostap
---
2.2.) test/relation and test/transaction have memory leaks, but it looks like they were introduced with one of the previous patches
---
WRT #2, making a semicolon obsolete will not fit well with the local variables, e.g.:
---
fn List(): rel { x, y: real }
{
p1: Point
p2: rel { x, y: real }
p1 = storage project(x, y);
p2 = storage project(x, y);
return p;
}
---
If we are to remove it completely it shall also apply to the statements, but (obviously) it is a big change and it needs further discussion. Adding a semicolon seems to make more sense as it is then consistent with the (yet to come) local variables declarations and does not require massive syntax changes.
- Ostap