3 ms·
I don't understand why people assume you need to rewrite the world to use ASTs! Keep text, as it is most universal to consume, and generate AST on the fly. Or
by theamk 3y ago
I don't understand why people assume you need to rewrite the world to use ASTs!
Keep text, as it is most universal to consume, and generate AST on the fly. Or serialize ASTs to xml and commit them. git is certainly flexible enough to work with non-text formats (a random example from internet: https://www.diffplug.com/features/git https://www.diffplug.com/features/git )
In particular, "any automatable refactoring should appear as the one tiny change it is" is trivial to add from the git side, just set "diffcmd" to whatever script does the logic. The hard part is actual logic to compare ASTs and derive if this is a "trivial rename" or "trivial rename except usage in file X is unchanged" or "trivial rename but I also made everything const".
Case in point, we use a 3rd party review tool at work (Reviewable) which overrides default github pull request diff screen and shows its own diff in a different format.