I don’t understand why languages like Java don’t provide for “persistent” definitions of relationships between variables. For example, we write code like:
float a0 = 20.5;
float a1 = 17.3;
float midPoint = (a0+a1)/2.0;
...
a1 = 23.7;
print("Mid point is: "+midPoint);
missing out the recalculation of midPoint and printing out the previously-calculated value.
Surely, we more often want to define a permanent relationship between variables? Why don’t we have a “this variable stands for the current relationship between these values” operator:
int midPoint @= (a0+a1)/2.0;
meaning that whenever midPoint is referenced from thereon in within the current scope, it is equal to the value calculated from the current values of a0 and a1? Why do we burden the programmer with having to “remember to recalculate” the value?