Reconcile All the Things
acko.net
acko.net
sidenote: the programming model of Observablehq is a data flow graph and its bloody excellent for hot developing a running program. You can swap one dataflow node for a completely different piece of code and leave the rest of the program state in place. This is finer grain iteration than a REPL.
The topic is reconciliation on top of that... and those kinda of experiments are possible. Observablehq exposes the "this" value to access the previous value of the node. So you can do traditional reconciliation: https://observablehq.com/@tomlarkworthy/reconcile-nanomorph
An individual dataflow at the top level can be seen as a stream of values.
I have not thought much about general reconciliation, but if I were shooting for maximum efficiency I would be thinking about maybe you could add delta sync to these streams.
I definitely observe the situation where I want a dataflow node to be an array of values, or an aggregate result over an array, and then I want to add a single datum to the dataset upstream. Currently everything just gets recomputed from scratch which seems wasteful. I am not sure if generalising reconciliation helps with the issue though.
Can someone explain why we couldn't concat / hash the incoming arguments and use those as the cache key? My understanding is that the cache key needs to be unique for its inputs, e.g. slow(1, 2) and slow(2, 1) would still give unique key values.
Edit: nevermind I think this is due to the core concept of WeakMaps, which I've never encountered, from the article:
> This is a key/value map that can hold data, but which does not own its keys. This means any record inside will be garbage collected unless another part of the program is also holding on to the same key.