News for hackers. Stuff that matters.
Re:Developer tool 'diff' is 40 years old: can it be improved? by JoeAltmaier on Monday August 26, 2024 @03:41PM (#41360990)
We had, back in the '90s, a 'semantic diff' that ignored whitespace, knew about programming languages, showed only significant code changes (not comments; not empty lines; not refactoring of code into a different number of lines). All I used after that.
Re:Developer tool 'diff' is 40 years old: can it be improved? by h4ck_th3_pl4n3t on Tuesday August 27, 2024 @01:35AM (#41364805)
There is this amazing tool called difftastic. I've been using it for years with git and it works like a charm. [1] [2]

[1] https://news.ycombinator.com/item?id=27768861

[2] https://github.com/Wilfred/difftastic

Re:Developer tool 'diff' is 40 years old: can it be improved? by skp1995 on Monday August 26, 2024 @06:01PM (#41362671)
isn't difftastic the new way to do this? https://news.ycombinator.com/item?id=39778412

I highly recommend trying it out.

Re:Developer tool 'diff' is 40 years old: can it be improved? by pipeline_peak on Monday August 26, 2024 @08:36PM (#41363573)
I think I need a tldr for a 12 year old because my answer to that question is: does it need to be improved?

Diff, like all the original Unix tools was only meant to do one thing, compare two files. The beauty in that being that it can be a core component of whatever you want.

UI extensions, algorithm adjustability to name some. But based on what Myers mentioned as someone else said, “improved diff” is partially a semantic diff. One that’s less cold blooded about trivial changes like white spaces.

I don’t mean to be the typical pedantic HN commenter but that sounds like a diff of commit objects rather than files.

Re:Developer tool 'diff' is 40 years old: can it be improved? by sevensor on Monday August 26, 2024 @09:08PM (#41363734)
> Or maybe you prefer to code with the classic old-school text editors, like vi (2012), Sublime Text (2008), or vim (1991)

Huh, vi was introduced 15 years after I first used it. Must have been inspired by vim. Think I’ll stop reading here.

Re:Developer tool 'diff' is 40 years old: can it be improved? by gloryjulio on Monday August 26, 2024 @09:32PM (#41363853)
Looks like it's written by llm where it mixed up the numbers
Re:Developer tool 'diff' is 40 years old: can it be improved? by safetytrick on Monday August 26, 2024 @10:06PM (#41363999)
vim is late 1991, vi was 1976, sublime text was 2008. Just seems like garbage writing (very easily could be LLM).
Re:Developer tool 'diff' is 40 years old: can it be improved? by sevensor on Tuesday August 27, 2024 @08:20AM (#41366734)
Regardless of how they messed up, they just successfully vaporized their credibility with me. It’s a big platform, and an obvious mistake that the editor should have caught. And if they care so little about my time that they’re not going to employ an editor, shame on them.

Needless to say, private parties get a lot more leeway with me. This isn’t a mistake that would phase me on a random person’s blog, but Stackoverflow speaks with the voice of authority. They have a duty to get it right.

Re:Developer tool 'diff' is 40 years old: can it be improved? by Maxim2572 on Tuesday August 27, 2024 @07:38AM (#41366454)
If you google "vi release date", you actually get the release of a certain League of Legends character (I think), which was introduced in 2012.

Not sure if this is a llm or just lazy research.

Re:Developer tool 'diff' is 40 years old: can it be improved? by thelastparadise on Tuesday August 27, 2024 @07:52AM (#41366539)
Seems like an LLM wrote this.
Re:Developer tool 'diff' is 40 years old: can it be improved? by OhMeadhbh on Monday August 26, 2024 @09:37PM (#41363883)
I think diff is at least 50 years old. It shows up in the unix v5 source from 1974.

https://minnie.tuhs.org/cgi-bin/utree.pl?file=V5/usr/source/...

Re:Developer tool 'diff' is 40 years old: can it be improved? by ilyagr on Monday August 26, 2024 @11:23PM (#41364318)
- https://github.com/dandavison/delta is nice for a prettier presentation of the same information as `git diff`.

- This may or may not qualify, since I think GNU diff supports it with an option, as does Git diff, but "Color-words" diff can be nice, where changes in the middle of the line are highlighted and whitespace is ignored.

- Somebody already recommended https://github.com/Wilfred/difftastic, which I second. It uses treesitter and is very interesting. Surprisingly, in practice difftastic is not always noticeably better than color words diff (don't expect miracles), but occasionally it is much better.

For the last two, see Difftastic's FAQ, https://github.com/Wilfred/difftastic#isnt-this-basically---...

Update: Finally, this blog post about difftastic describes some details: https://www.wilfred.me.uk/blog/2022/09/06/difftastic-the-fan...

Update 2: Finally finally, Difftastic's wiki has more related tools: https://github.com/Wilfred/difftastic/wiki/Structural-Diffs. Difftastic's author writes many interesting things, it seems :).

Re:Developer tool 'diff' is 40 years old: can it be improved? by stuaxo on Tuesday August 27, 2024 @03:26AM (#41365276)
It would be great if this were accompanies by a patch to diff itself.
Re:Developer tool 'diff' is 40 years old: can it be improved? by hulitu on Thursday August 29, 2024 @05:16PM (#41395382)
> Developer tool 'diff' is 40 years old: can it be improved?

Fix the bugs first, please.