Live data from Hacker News

How far should a programming language aware diff go?

semanticdiff.com

41–50 of 54 posts

Re: How far should a programming language aware diff go?

#41
- def foo(): int | None + def foo(): None | int

Whether or not this makes a semantic difference is language implementation dependent. I think that is why this kind of tool is not especially appealing to me. I would have to have almost complete knowledge of the compiler and the diff tool to truly trust that there is no semantic difference. Moreover, I would like to know why changes to the text that are being made that have no semantic effect are being mixed with those that do.

For me, text is king and that is the level at which I want to evaluate diffs 99% of the time, but I do recognize that others have different goals and preferences.

Re: How far should a programming language aware diff go?

#42
Personally, I really don't care about these cases. What really grinds my gears is when a diff plucks out a weird line in the middle of a block of code that only has a closing curly brace and that's the line that it thinks is the same, and everything around it is a diff.

If you're going to call yourself a semantic diff-ing company, fix that before you worry about the order of my imports.

Re: How far should a programming language aware diff go?

#46
post #5

> - const foo = function(a, b) { ... } > + const foo = (a, b) => { ... } Assuming this is JS code, these differences should not be ignored, as an arrow function can behave differently than a traditional function.

Yeah, that was a bit of an unfortunate example for a blogvertising post. Even I as a non-frontend developer knew to watch out for that one. A company working with semantic diffs should really know better and such mistakes do not inspire confidence for me!

Re: How far should a programming language aware diff go?

#47
post #5

> - const foo = function(a, b) { ... } > + const foo = (a, b) => { ... } Assuming this is JS code, these differences should not be ignored, as an arrow function can behave differently than a traditional function.

Same goes for the loop example, where the i variable has a different scope.

I think those are meant to be illustrative of an idea rather than exact examples.

Re: How far should a programming language aware diff go?

#48
post #5

> - const foo = function(a, b) { ... } > + const foo = (a, b) => { ... } Assuming this is JS code, these differences should not be ignored, as an arrow function can behave differently than a traditional function.

Same goes for the loop example, where the i variable has a different scope. I think those are meant to be illustrative of an idea rather than exact examples.

But if they have worked in this field for a few months, shouldn't they have a crapton of exact examples to draw from? If not, isn't that worrying?

Re: How far should a programming language aware diff go?

#49
post #48

Earlier quoted context omitted.

Same goes for the loop example, where the i variable has a different scope. I think those are meant to be illustrative of an idea rather than exact examples.

But if they have worked in this field for a few months, shouldn't they have a crapton of exact examples to draw from? If not, isn't that worrying?

Depends on how technical the audience of this post should be. Putting an accurate example which is only understandable to someone with years of experience might make newbies think it's a made up concern.
Post reply on HN