Yesterday, I shared some spicy takes. A few were particularly controversial—most notably, that I correct Gif the correct way (with a soft G)—but I also got a lot of emails asking me to elaborate on a few of them.
Today, I wanted to talk about how tabs are objectively better than spaces. This won’t take long.
Tabs let you define how big you want each indent to be, and spaces do not.
Using only tabs for indentation and only spaces for alignment will never result in crap alignment when adjusting tabstops because the alignment does not use tabs.
This is using both tabs and spaces for alignment.
--->funcfoo(int i,
--->---> int j);
Observe what adjusting the tabs does,
->funcfoo(int i,
->-> int j);
This uses only spaces for alignment,
--->funcfoo(int i,
---> int j);
When converted the alignment is maintained because the tabstops aren’t used for alignment, only for indentation.
Using only tabs for indentation and only spaces for alignment will never result in crap alignment when adjusting tabstops because the alignment does not use tabs.
This is using both tabs and spaces for alignment.
--->func foo(int i, --->---> int j);
Observe what adjusting the tabs does,
->func foo(int i, ->-> int j);
This uses only spaces for alignment,
--->func foo(int i, ---> int j);
When converted the alignment is maintained because the tabstops aren’t used for alignment, only for indentation.
->func foo(int i, -> int j);