3 ms·
> code execution could be mapped to diffs between state transitions to provide rewind functionality and debugging for free. Some of what you're saying reminds
by throwitaway1123 2y ago
> code execution could be mapped to diffs between state transitions to provide rewind functionality and debugging for free.
Some of what you're saying reminds me of the JS library Immer. Using JS proxies (which can intercept and detect arbitrary object mutations), it allows you to produce a new state by mutating a "draft" copy of the current state.
The produceWithPatches function provides you with arrays of patches and inverse patches that are essentially diffs between the old state and the new state. You can then apply these patches and inverse patches (using Immer's applyPatches function) to rewind the state backwards and forwards. Elm was one of the first languages (on the frontend at least) to pioneer this concept of "time travel debugging", which was then popularized by the Redux DevTools web extension.