In addition, all cells which depend on C must be reevaluated. This process repeats until there are no more changes in the values of any cell (change propagation).
You could model the dependencies as a directed graph, and ensure that there's no cycles in the graph, and if there is, don't evaluate and warn/error msg the user.
Comments
What if there are circular dependencies?
You could model the dependencies as a directed graph, and ensure that there's no cycles in the graph, and if there is, don't evaluate and warn/error msg the user.
Svelte won't let you. Knockout claims it isn't a problem. What happens in Excel, are you able to create circular dependencies there and crash Excel?
How would Svelte prevent a user from creating an infinite recursion at run-time? It doesn't know what the cell's expressions are at compile time.
Not stated, but I'd do what Excel does which is to have a maximum recursion level.