> disliked primarily for historical and technological reasons
Huh? AFAIU, all the historical source code uses tabs for indentation. Both K&R and BSD style uses hard tabs, as does Linux kernel style and most older GNU project code for that matter. Various Unix programs assume tabs, for example indentation elision in shell heredoc syntax ("<<-") only works for tabs.
Soft tabs (spaces) has been a relatively new thing in the C/Unix world. You may not notice it because, working as well as they do, hard tabs magically indent according to your local preference, so hard tabs aren't noticeable.[1]
[1] What doesn't work is right-hand alignment. That's most noticeable in modern BSD code, where the style is to tab-align variable types and names into different columns. If your tab stop isn't set to 8 (the required tab stop), they don't line up. Most hard tabbers don't mix indentation and alignment, anymore.
EDIT: Here's the earliest source code for vi I could quickly find: https://github.com/n-t-roff/ex-2.2/blob/220a2cfa/ex.c
It uses hard tabs. It's also still using pre-ANSI function syntax, suggesting this code wasn't cleaned up before committing to Git.
Ok apparently I'm super ignorant about this. WTF are people going on about spaces for if hard tabs are the historic standard? I always assumed that Go was progressive, C++ was the norm (ie had no preference), Python and Nim were designed by diehards clinging to the past, and that people were exhibiting their rather famous resistance to change. Apparently this is completely wrong?
I seem to have made assumptions due to only running into spaces in "old" places such as Python, Vim, Emacs, etc. To be fair, this all happened well before I was born. Why would software developers of all people try to do away with a useful abstraction?!
Oddly, the linked keyboard doesn't appear to have a tab key but the Vi source code you found contains them? Am I missing something obvious?
(`/* Copyright (c) 1979 Regents of the University of California */`, that's some impressively old code to find on GitHub.)
Re BSD: Yeah, tabs don't work for alignment almost by definition. I'm surprised anyone was crazy enough to author a code style that called for it.
Bit strange thinking of Python as "old" .. anyway, what I suspect happened was that tabs were the "new" innovation - in the post-punchcard era. Punchcards couldn't meaningfully have a tab character, but they could have fixed character positions, and this feature was required by COBOL and FORTRAN in their day. It was still present in the F77 standard.
I think the other thing that got in the way of standardising on TAB was that 8 character indent is too much, but once you let people configure it it's no longer consistent between systems.
> that's some impressively old code to find on GitHub
Python is about 30 years old. Started by Guido van Rossum in December 1989.
Python is older than HTTP, older than the Web.
It's older than most programming languages still in common use today (TIOBE).
I think most people would think of Python as "old" if they thought about its history. Its current cool factor in AI and employment makes it seem newer than it is.
> Oddly, the linked keyboard doesn't appear to have a tab key but the Vi source code you found contains them? Am I missing something obvious?
Vi has the insert-mode commands for indenting (Ctrl-T) and unindenting (Ctrl-D) the current line. If you're used to them, you don't really need Tab except for aligning things within the line. Also, Tab is Ctrl-I.
Huh? AFAIU, all the historical source code uses tabs for indentation. Both K&R and BSD style uses hard tabs, as does Linux kernel style and most older GNU project code for that matter. Various Unix programs assume tabs, for example indentation elision in shell heredoc syntax ("<<-") only works for tabs.
Soft tabs (spaces) has been a relatively new thing in the C/Unix world. You may not notice it because, working as well as they do, hard tabs magically indent according to your local preference, so hard tabs aren't noticeable.[1]
[1] What doesn't work is right-hand alignment. That's most noticeable in modern BSD code, where the style is to tab-align variable types and names into different columns. If your tab stop isn't set to 8 (the required tab stop), they don't line up. Most hard tabbers don't mix indentation and alignment, anymore.
EDIT: Here's the earliest source code for vi I could quickly find: https://github.com/n-t-roff/ex-2.2/blob/220a2cfa/ex.c It uses hard tabs. It's also still using pre-ANSI function syntax, suggesting this code wasn't cleaned up before committing to Git.