Live data from Hacker News

How far should a programming language aware diff go?

semanticdiff.com

1–10 of 54 posts

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

#2
Interesting idea. I've just tried it with a couple of languages:

- TS with Vue: SFC are not really working (it's showing a style change as if the whole stylesheet were replaced with a mostly-identical stylesheet).

- Rust: It doesn't seem semantic at all. It's showing a lot of character-level insertions and deletions that seem worse than how git-diff or GitHub would break down the changes.

It doesn't seem ready yet for what I'd like to use it for.

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

#3

Interesting idea. I've just tried it with a couple of languages: - TS with Vue: SFC are not really working (it's showing a style change as if the whole stylesheet were replaced with a mostly-identical stylesheet). - Rust: It doesn't seem semantic at all. It's showing a lot of character-level insertions and deletions that seem worse than how git-diff or GitHub would break down the changes. It doesn't seem ready yet fo…

Hi, author of SemanticDiff here.

I'm sorry you didn't have a good experience testing the tool. If it doesn't work / makes things worse than a standard diff, that's definitely considered a bug. It is probably something specific to your code and not a general issue. It would therefore be great if you could open an issue [1] or support ticket [2], ideally with some sample code, so we can take a look. Thanks in advance!

[1] https://github.com/Sysmagine/SemanticDiff/issues [2] support@semanticdiff.com

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

#4
I was expecting this to refer to different ways to represent the same diff. (For example, you could represent a change from `console.log(“hello”)` as `console.log('hello')` as +'-“ … +’-“ or as +'hello'-“hello”)

I don’t have a specific example in mind, but it seems reasonable that different languages could benefit from different ways of representing the same diff.

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

#9
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.

More specifically, the `function` keyword version of an anonymous function preserves the keyword `this` whilst the arrow syntax anonymous function does not. Arrow functions also cannot use the `yield` keyword nor be used as constructors

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

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

#10
post #8

Accurately identifying whether any change is a semantic difference involves solving the Halting Problem, right?

Fortunately the article already says that hiding all semantically identical changes is "probably going too far", so they can just not try and solve the halting problem.
Post reply on HN