I take this a step further and will often split out a single sentence into a clause per line, but this is a judgement call rather than a hard and fast rule.
I take this a step further and will often split out a single sentence into a clause per line, but this is a judgement call rather than a hard and fast rule.
I get so tired of seeing diffs where I add a function and the diff shows that I added it inside the previous function instead of between them, because it starts the diff one line too early.
When you get a NPE on a line containing `thing.method(x.y.z, q(), w.e().rty())`, which item is it on? Type information is insufficient, there could be multiple of the same thing on the same line.
Some debuggers are smarter ("step to cursor" sometimes goes to in-line locations), but many are not, and most languages I've seen will give you precise compile-time error locations, but at runtime all you get is lines. Lines suck.
It's not a problem itself, it's a symptom of a deeper problem: we represent all of our code as plain text.
We have built almost everything around plain text, for a long time now. The few things that aren't built around plain text tend to require either proprietary software or open software that seldom lasts more than a decade.
Yes, plain text has impressive strengths (see: https://news.ycombinator.com/item?id=30521545) but it may be holding some areas back.
There has always been talk of smarter diffing tools (new diff algorithms, syntax aware diffing, semantic diffing) but it tends to get hamstrung around supporting plain text.
Usually the approaches go with one of two ways. Either:
1. a diffing algorithm has a smarter diffing algorithm than what we already have, until it gets into a corner case and ends up worse than what we already have.
2. an LSP-like service goes through the effort of building a full AST to perform diffs with, only to convert everything back to plain text in the end. This makes diffing take longer. The fact that ASTs can't represent some changes and we don't realize until after the work is done doesn't help this.
I'd wager that over the next few decades, new languages are going to migrate away from plain text representation and move entirely to AST representations. ASTs can be perfectly diffed, and only writing code as an AST means that it'll be impossible to write some kinds of code that is almost correct.
There's a few academic research languages around this, but I think one of the more interesting explorations with this kind of AST only development styles has to be by Dion Systems: https://dion.systems/blog_0001_hms2020.html
They basically acknowledge that we as developers are not going to move to a new AST-based tool if it's not going to work with our other tools, so they want to experiment across the development workflow to see how well ASTs can work across the development space.
Their 2020 talk about this was fascinating: https://vimeo.com/485177664
People often say of git, "The porcelain is bad but the plumbing is good". The opposite is true for digging, IMO.
git config --global diff.tool vimdiff
git config --global difftool.prompt false
Typing `git difftool` yields the expected behavior.:qa in vim cycles to the next file in the changeset without saving anything.
Also, by default, git calls vimdiff with the -R option. You can override it with
git config --global difftool.vimdiff.cmd 'vimdiff "$LOCAL" "$REMOTE"'
This will open vimdiff in writeable mode which allows edits while diffing.:wq in vim cycles to the next file in the changeset with changes saved.
See `git help diff`
Hacker news today says that OpenNLP 2.0 just came out. That should work.
It isn’t necessary to have each sentence on a single line in order to achieve that. It’s sufficient to have a line break after each sentence, but you may also have additional line breaks in the middle of a sentence. That’s how I format plain text when diffs are relevant.
Sometimes it also makes sense to not have a line break between closely related (and possibly short) sentences. In the end it’s the semantic coherent unit of thought that counts, not the syntactical sentence-ending period or full stop.