4 ms·
This is a bit of a holy grail, that in practice isn't actually that important. https://stackoverflow.com/questions/523307/semantic-diff-utilities https://stack
by taeric 9y ago
This is a bit of a holy grail, that in practice isn't actually that important. https://stackoverflow.com/questions/523307/semantic-diff-utilities https://stackoverflow.com/questions/523307/semantic-diff-uti... has a good overview of some of the possibilities.
Makes for amazing demos. Might some day be what we are all using. My hopes have been dampened severely by how long this has taken to make any head way. (And, honestly, it couples your diff tool to the rest of your tool chain rather heavily. I can see why it has a hard time taking off.)
- zaptheimpaler 9y agoAs a newbie to how diff-ing is done in production, does git use vanilla edit-distance diffing too?
- peff 9y agoGit uses Myers diff, but recently added some heuristics to "shift" the hunks in semantically meaningful ways. See https://github.com/mhagger/diff-slider-tools https://github.com/mhagger/diff-slider-tools for the experiments that led to this feature. It also supports a few other diff algorithms: `--patience` and `--histogram`, but in my experience they produce the same output as Myers in most cases.
- ProblemFactory 9y agoI think you could get 90% of the utility of semantic syntax tree diff by standard text diff + some simple rules. For example preferring to split on empty (whitespace-only) lines. Almost all languages and coding styles use empty lines as a "semantic separator" marker.