Hacker News new | ask | show | jobs
by dosinga 1216 days ago
It's a conscious decision. The spreadsheet recalculates itself, the python code doesn't. Recalculations in the spreadsheet are determined by the graph (cell Q3 depends on cell D4 because it mentions it in it's formula like "=D4 * 3") If Q3 calls a python function ("=my_function()") and in that function D4 is mentioned we don't add it to the graph. It is already hard enough as is to see the dependency graph in a spreadsheet - adding implicit relations to it would make this almost impossible.
1 comments

In Observable, a cell can define a function or return a value. When the value of a free variable within a function definition changes the function is redefined rather than the function being rerun. So there is a clear difference between points at which the function's bound variables come into play (function invocation) and the points when changes to the free variables have an effect (function definition). It's far from unmanageable in that "reactive notebook" setting. Maybe spreadsheets are the problem...

FWIW: https://www.nature.com/articles/d41586-021-01174-w