VictorCMiraldo / hdiff

Hash-based Diffing for AST's
MIT License
74 stars 3 forks source link

Sharing #24

Open VictorCMiraldo opened 4 years ago

VictorCMiraldo commented 4 years ago

(very loose notes follow)

Sharing is a constant complication and advantage of the hdiff approach. We do see interesting things related to it, for example, patches have some sort of eta-inequality:

[0] -|+  Bin [0] Leaf  > Bin [0] [1] -|+ Bin (Bin [0] [1]) Leaf

This has implication on merging, for example.

One option for controlling sharing can be seen in here, where we pass around a function that decides to add some prefix to the hash of certain AST elements. The big issue is that if we rename a function, we loose sharing of its contents.

I'd like to have a better story here. How to actually control that we want to share all the variables named "aux" that occur inside the same function, but not outside the function scope, for example. Naturally, this has to be resistent to function renaming. Upon seeing a rename, we must be able to detect that the body should be shared.