I had some time and thought about an event-based programming language. By that I mean a language where every variable is updated, when you change a dependent variable. For example consider the following pseudo-code for a terminal-application:
int a = 5
int b = a + 5
// event which is called every 5 seconds
every 5 seconds =>
{
// update a by adding 5
a << a + 5
}
// event which is called when the user presses enter
on enter =>
{
println("b = " + b)
}
Pressing enter will print the value of b. But the result will be 10 only for the first five seconds, because after that a will be updated to 10 and for the next five seconds b will equal 15, because b depends on a.
This concept will bring certain problems, of course, but it also offers some benefits. Imagine for example a GUI-application (which is normally programmed with events), which shows two inputboxes and the result of adding the two numbers:
------------- -------------
| 5 | + | 6 | = 11
------------- -------------
It could be programmed in the following way:
// two inputboxes and a label
Textbox tb1 = new TextBox() { format = "numeric", value = 5 }
Label lbl1_plus = new Label() { value = "+" }
Textbox tb2 = new TextBox() { format = "numeric", value = 6 }
// and the result
Label lbl1_plus = new Label() { value = "= " + (tb1.value + tb2.value) }
Thats it. It is a little bit like excel, but with real programming. Is there a programming language like this? Or something similar?