7 ms·
If you think about Makefile syntax being an earlier member of the same family as Python, the major difference is that tab may have been a more ubiquitous indent
by ploxiln 10y ago
If you think about Makefile syntax being an earlier member of the same family as Python, the major difference is that tab may have been a more ubiquitous indent convention at the time (but I really don't know).
I still prefer to indent C with tabs, and I'm not the only one. It's really not hard to handle tabs well, as a code editor or as a programmer. You can view them as whatever width you like. You can have marked to distinguish from spaces (e.g. vim's "set list"). They've been around for longer than you have so there's no good excuse for forgetting about them.
- ChuckMcM 10y agoOne of the nice thing about indenting with actual tab characters is that you separate the notion of 'indentation' from the actual indentation. I set my tab stops to 4 which tightens the code, others set it to 8, still others set it to 2. If the code has tab characters it just works, if the code has spaces there is no way to have your most comfortable indentation level be used.
- OJFord 10y agoYes, yes, yes. I'm saddened that tabs have essentially 'lost' - they seem to me in every way superior to spaces, but I would never use them in a new project simply because it would be likely to throw off others, and perhaps tooling. Github, for example, does not play nicely.
- taneq 10y agoSpaces are superior to tabs in only one (important) way: They're a constant width.
- paulddraper 10y agoBam-bam-bam-bam. Sorry can hear you over all the whitespace I have to type.
- adrianN 10y agoEvery editor worth its salt does this for you. Maybe try upgrading from ed.
- Walf 10y agoIf only there was a way not to have to rely on editors all behaving the same with leading spaces. Oh wait, there is a way: indent with tabs.
- adrianN 10y agoI also prefer tabs. I'm just saying that "I have to wear out my spacebar" is not a good argument.
- paulddraper 10y ago"This is a good decision because we've forced every editor to handle this good decision well."
- btschaegg 10y agoYeah, indenting with spaces wastes so many punch cards! Oh, wait.
- rbanffy 10y agoActually, a punch card used to represent a single line. But you'd be wasting holes.
- btschaegg 10y agoNot that I've ever used one, but I wouldn't expect someone to indent any code on a punch card. I just felt the comment was suiting since it must have been about when they were still used that you couldn't automate indentation.
- 10y ago
- ktRolster 10y agoThe proper way is tabs to the point of indent, and spaces thereafter. Even Github will work if you do that.
- OJFord 10y agoGithub works better if you do that, agreed. But IIRC (I don't do this any more, so this is from memory) it uses eight space tabs as a default, and can only be changed on the 'raw' pages.
- TeMPOraL 10y agoThey're superior only in C-like languages when you indent in constant-width levels, and then only if you use very short names in your code. Try using tabs to indent e.g. arguments to function one under another, and weep.
- dragonwriter 10y ago> Try using tabs to indent e.g. arguments to function one under another, and weep. Where the terms are distinguished in a programming context, that's alignment, not indentation; tabs for indentation, spaces for alignment is a common suggestion.
- TeMPOraL 10y agoSure, as long as you don't mix them on one line (i.e. first indent, then align), because then differences between tab widths will still break alignment.
- dragonwriter 10y agoFirst indent and then align will retain alignment with different tab widths, because you only align things that are at the same indent level, so different tab widths in a tab indent / space align combination just move the whole aligned block left or right without affecting alignment.
- TeMPOraL 10y agoI stand corrected.
- sophacles 10y agoNot if you do it right: \t\tsome_func(arg1, \t\t arg2, \t\t argN) will look right no matter what the tab width is.
- TeMPOraL 10y ago
- jwilk 10y agohttps://twitter.com/__apf__/status/827964865012649984 https://twitter.com/__apf__/status/827964865012649984