4 ms·
Alignment is the problem here, not the proportional font. I gave up alignment in my code many years ago, back when I was still using monospaced fonts. I gave i
by Stratoscope 13y ago
Alignment is the problem here, not the proportional font.
I gave up alignment in my code many years ago, back when I was still using monospaced fonts. I gave it up because I was really tired of fiddling with spaces when I changed a name in code like this:
myType someFunctionName(someType someVariable,
someOtherType someOtherVariable,
int foo) {
...
}
So I started doing this instead:
myType someFunctionName(
someType someVariable,
someOtherType someOtherVariable,
int foo
) {
...
}
I found that I just didn't care that "someVariable" and "someOtherVariable" weren't lined up one above the other. In fact, I actually liked the fact that the variable names and types were closer together, so my eyes didn't have to keep scanning across a sea of whitespace to match things up. And I really liked not having to add and remove spaces every time I changed a name.
As a bonus, the overall width of my code was often much less, as in this example.
Later I discovered that using this style, my code looked the same in a proportional font as it did in a monospaced font. So I switched to a proportional font and never looked back. But the code is still just as readable in a monospaced font.
- dspillett 13y agoI still use space based alignment a fair bit, though it can be faf. What would be really nice is for a code editor to support some sort of elastic tab-stop so I can tell it that some things should stay aligned and have it do any extra work needed. I'm not sure how that could be made low-/zero-effort easy from a UI PoV though, but it would work just as well with proportional fonts too.
- sanityinc 13y agoPlus, as variables get added and renamed, the resulting realignment of tokens modifies lines unrelated to those changes, leading to messy diffs which degrade the effectiveness of most version control tools.
- kisielk 13y agoAlmost every diff and code review tool I've used can ignore whitespace changes.