6 ms·
The point of the "tab" option is that there is no consensus on the number of spaces to use -- so by using tab, one uses a single character, and allows the devel
by mjburgess 1y ago
The point of the "tab" option is that there is no consensus on the number of spaces to use -- so by using tab, one uses a single character, and allows the developer to determine screen spacing to their comfort.
"Tab" being a live option is a symptom of the war-never-over in absolute spacing degree -- since different people have different eye-sight, eye-strain, etc. constraints, different linguistic familiarities, code-density preferences, and so on.
- boomskats 1y agoDidn't you read the post? The WAR is OVER. End of discussion!!1 (golang converted me to tabs too)
- wslh 1y agoNot OP, but the article ends with the following question: > Is it truly over? ;-)
- smrq 1y ago"The war of accessible vs inaccessible is over; 90% of websites don't use ARIA attributes correctly, so the other 10% ought to give up already." That's how TFA reads to me. Never give up, never surrender.
- o11c 1y agoThere absolutely is a consensus: a hard tab is defined as 8 spaces in numerous standards (obviously this only applies to monospace fonts). The fact that people choose to reject this does not change the reality.
- maccard 1y agoReally? What standards are they?
- Joker_vD 1y agoLike what standards, exactly? POSIX in its tabs(1) [0] and expand(1) [1] clearly states that tab stops can be wherever, and "every 8 columns" is just a default. [0] https://pubs.opengroup.org/onlinepubs/9799919799/utilities/tabs.html https://pubs.opengroup.org/onlinepubs/9799919799/utilities/t... [1] https://pubs.opengroup.org/onlinepubs/9799919799/utilities/expand.html https://pubs.opengroup.org/onlinepubs/9799919799/utilities/e...
- zamadatix 1y agoThat still wouldn't give consensus on how many spaces people using spaces should use, it would (originally) give consensus on how many spaces a tab was supposed to be.
- g-b-r 1y agoThe few applications that don't let you configure it are less relevant now, and the alternative to consider tabs of varying lentgh would be to introduce a new spacing character in their place; hardly feasible.
- eviks 1y agoReality is what people use. Consensus is what almost all people agree on. Standard is just some rule a few people thought would be good to follow.
- whoomp12342 1y agoAnd what say you about reaching a consensus on the number of tabs to use?!?!?!
- g-b-r 1y agoIf someone uses more than one tab per level of indentation he should be forbidden access to editors for life
- whoomp12342 1y agoAnd now you understand my method of driving nit picky code reviewers crazy! bwahahahahahhaha
- quietbritishjim 1y ago> so by using tab, one ... allows the developer to determine screen spacing to their comfort (Allow me to reply to this age-old argument with the age-old counter argument...) But you also have to decide at what point to hard wrap each line based on a max line length, and you can only do that based on some choice of tab size. Anyone with a different tab size preference would see the right column wandering depending on indentation level. This invalidates the only advantage of tabs (assuming file size is no longer a concern). A common retort is that each reader's auto format (or soft wrapping) can sort out the wrapping. But if each coder is going to reformat the code anyway then they get the benefit of choosing their own indentation level regardless of tabs vs spaces.
- JohnFen 1y ago> But you also have to decide at what point to hard wrap each line based on a max line length I think that you should not be doing this, for the same reason that you should use tabs. It allows the user to select whichever hard wrap point (if any -- I generally choose to not have one) they prefer. But all of this sort of thing is pointless debate these days, when it's pretty fast and easy to preprocess the files to match your preferences prior to editing.
- deleted 1y ago[deleted]
- eurleif 1y ago>It allows the user to select whichever hard wrap point (if any -- I generally choose to not have one) they prefer. And then have merge conflicts between people who set different hard wrap points? Did you mean to say soft wrap point?
- JohnFen 1y agoYes, my mistake.
- 1718627440 1y agoBut you don't hard wrap at exactly the max line length anyway. You wrap at the somewhere sensible near the max line length. This is much more tolerable to size changes in indentation.
- DanHulton 1y agoI used to defend tabs for this reason, except I kept running into source code formatters/displays online that would attempt to display my code with the tabstop set to 8 spaces, which made it nigh-unreadable. While I run into fewer that do this nowadays, it still reminds me that with tabs, What I Write May Not Be What You See, which can lead to readability issues, which I feel is a solid enough point against tabs that I've switched. I write code so it is easy to read, and spaces are better for that than tabs, so now I use tabs. ¯\_(ツ)_/¯
- ar_lan 1y ago> I write code so it is easy to read, and spaces are better for that than tabs, so now I use tabs. ¯\_(ツ)_/¯ This is a very confusing final sentence. :)
- hulitu 1y ago> that would attempt to display my code with the tabstop set to 8 spaces, Which is the right thing to do. When did the tab stopped having 8 spaces ?
- moomin 1y agoI’d say that one’s approaching resolution, too. And 4 has won.
- frizlab 1y agoI use tab at three. And will do to the day I die.
- ben_w 1y agoSometimes I remember a workplace system I used, where someone had set tabs to 8 space. I don't know why it was 8, but it was.
- PlunderBunny 1y agoThe VAX/VMS terminals we used at university to learn Pascal defaulted to 8 space tabs, on a 80 column screen. That certainly pushed some people towards using spaces.
- 1718627440 1y agoI use 8-sized tabs with 72 columns in C. The human eye doesn't like moving all that much while reading and more windows fit one the screen even if it is annotated with git blame. In addition there is this argument from Torvalds, that you should mind your maximum nesting in a single function, which I also find useful.
- Jensson 1y ago> In addition there is this argument from Torvalds, that you should mind your maximum nesting in a single function, which I also find useful. Note that nesting is a much bigger issue in a language like C where you have to clean up after yourself, in most languages having a lot of nesting in a function isn't an issue.
- g-b-r 1y ago
- SAI_Peregrinus 1y agoBut an editor can just as well let the user choose what width to display spaces at the start of a line. Nothing forces them to be the same width as spaces in the middle of a line.
- eikenberry 1y agoBut don't fixed width fonts, which many consider the best for code, mean fixed width spaces too?
- SAI_Peregrinus 1y agoIf that were the case tabs would be fixed width too. But they're not. There's no fundamental reason tabs have to be the only variable-width character.
- eikenberry 1y agoTabs would only be variable in the number of spaces uses, but those spaces will be fixed width.
- jononor 1y agoAnd spaces could be variable in the number of "sub-spaces" used. Each could be say 1/8 of a regular space.
- em-bee 1y agowhich editor does that? space width is defined by the font, and normally you use monospace fonts. i am unfamiliar with any editor that allows you to choose a different font for spaces. besides, it would only work for indents, it would mess up any alignment of code into columns.
- SAI_Peregrinus 1y agoNone, but it's clearly possible to add since such handling is already present for tabs in almost any editor. I merely mean that there's no technical restriction.
- barbazoo 1y agoOne or two tabs though?! /s
- pabs3 1y agoThe right number of spaces to use is one.
- deleted 1y ago[deleted]
- birn559 1y agoThe problem with this is: 1. It's relatively hard to think it through to the point that you see and have the potential benefits in all cases(*). 2. All participants and tools must fully support the solution. It needs a momentum it never got so the world settled on a simpler solution. (*) Tabs only and no hard wraps, only soft wraps.
- conartist6 1y agoThe war is ending though. It will be over when we finally format code at read-time so that we respect the viewer's preferences, instead of at save-time to reflect the authors'.
- mjburgess 1y agoVertical spacing, ideally, reflects the thought process behind the construction of code: it's semantic. Read-time revisions to spacing need, only, to change the non-intentional elements of spacing -- indent depth is a very good candidate for this (hence the tab character!).
- Ferret7446 1y agoWe already do format code at read-time if you use a decent editor/IDE. You can add smudge/clean filters to Git also.
- msgodel 1y agoI personally went through a phase where I compromised by doing one space per indentation level. Realistically tabs are best when you're alone and spaces are better when you're collaborating IMO.