An expression is a computation that reduces to a single value of type A
.
Expressions can be understood as data-flow variables. When a tree is
composed, a change in the root of the tree propagates through to the leaves
in the form of an emitted Change
event that carries the old and new
value (according to the particular node of the tree).
Basic expression types are Expr.Const
- it simply wraps a constant value
and thus will never change or fire an event - and Expr.Var
which can be
thought of as a mutable variable carrying a peer expression. When the variable
assignment changes, the expression currently held is evaluated and propagated
as an event. Intermediate nodes or expressions might modify the value, such
as a binary operator (e.g., an integer expression that sums two input
integer expressions).
- Companion:
- object