14 ms·
The Tabs vs. Spaces war is over, and spaces have emerged victorious
- mjburgess 1y agoThe 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.
- phplovesong 1y agoTabs are better, simply because you can view them as you like. Go obviously does this, and Haxe too (with default formatting options, even tho its configurable)
- gte525u 1y agoThis works until someone tries to vertically align something like a table or a line that is wrapped.
- marssaxman 1y agotabs for indentation, spaces for alignment
- skylurk 1y agoMeanwhile, I'm trying to get away from languages where whitespace has semantics.
- PaulDavisThe1st 1y agoIt's not about semantics at all. whitespace has (virtually) no semantics in C or C++, but there are few programmers who would feel comfortable reading such code without the suggestive hinting that indentation provides.
- pepa65 1y agoVery few where you can delete or insert whitespace at will, (even if only in the middle of 'identifiers'). I am fine with a (single) space being an important part of syntax, just don't use more than 1 please.
- fmbb 1y agoOnly a goblin would align code. But if you must you can start with a new line and the right indent.
- jihadjihad 1y agoRob Pike on why Go is indented with tabs [0]: > How wide should the indentation be? 2 spaces? 4? 8? Something else? > By making the indent be a tab, you get to decide the answer to that question and everyone will see code indented as wide (or not) as they prefer. > In short, this is what the tab character is for. 0: https://groups.google.com/g/golang-nuts/c/iHGLTFalb54/m/zqMoq9JRBAAJ https://groups.google.com/g/golang-nuts/c/iHGLTFalb54/m/zqMo...
- throwawayqqq11 1y agoExactly. Indentation != spacing. And thats all the argument i need. I dont understand why people argue with consistent text layout for all-spaces. You can use tabs to indent and spaces to align after that, in most cases.
- lesuorac 1y agoYou use tabs to delimitate tabular data. Unless you're trying to argue that your code is a tsv file then tabs is the wrong thing to use.
- rafram 1y agoYou use line feeds (\n) to instruct your teletype machine to feed in one more line of paper. Unless you're trying to argue that your text editor is a teletype machine, then line feeds are the wrong thing to use.
- lesuorac 1y agoI think most people are pretty amenable to the argument that text editors are teletype machines. Nobody cares that phone calls happen over fiber now instead of telephone lines. So, same should apply to teletype. Nobody is going to care you're reading this over fiber instead of a telephone line. Now, people do care if they're trying to read a csv document and somebody didn't quote their commas within strings and now the values are in the wrong columns which could've been avoided by using tabs to store tabular data.
- personjerry 1y agoWait until you guys hear about fibonacci tab spacing: https://marketplace.visualstudio.com/items?itemName=ewic.fibonacci-tabbing https://marketplace.visualstudio.com/items?itemName=ewic.fib...
- jedberg 1y agoThis is the first I've heard of this, but honestly, I think this would be really good for beginners! Generally, you shouldn't have all that many indents in your function. Using this would be a good visual clue to a beginner that maybe they need to break out their function into multiple functions.
- hotsauceror 1y agoNot that one more opinion in this endless war of opinion will matter, nor will it convince anyone, but I genuinely don't see the issue with "tabs for indentation, spaces for alignment."
- o11c 1y agoEvery repo that tries that ends up broken. I've looked at a lot of them. Also, any use of hard tabs breaks diffs, which should make tabs a non-starter.
- IncreasePosts 1y agoIndentation is alignment
- microflash 1y agoIndentation is columnization.
- IncreasePosts 1y agoColumnization is alignment
- sergiotapia 1y agoJust gimme a `go fmt` or `mix format`. These discussions are so 2007! :)
- cesaref 1y agoI remember these discussions in the 80s...
- taeric 1y agoWithout tab stops, tabs always fall a bit short. I'm now vaguely interested in hate making a programming language that relies on tabs and field/record separators. Just to really embrace the crazy.
- the_mitsuhiko 1y agoThe war is mostly over because regardless of it you use tabs or spaces, the many modern languages use a code formatter and reformat to whatever is common. Languages that go with tabs are also now routinely mixing it with spaces for visual alignment and assume a certain tab width for total visual width enforcement. On the other hand editors often now handle spaces as if they are tabs, even for cursor movement. So well. Both won? I remember a time when people religiously claimed that both tabs need to be the way to indent but also that they have to be 8 spaces visually. I guess at least that war was lost since now even CSS allows you to change the number of visual spaces a hard tab has.
- frizlab 1y agoAnd yet, navigating the code, you still have to got left-left-left-left to pass the indentation and it’s stupid. Tabs are here, everybody should use them, they are the logical better option, everybody knows it.
- tinco 1y agoNo one who uses tabs would ever assume a certain tab width for visual alignment. What do you base that slanderous statement on? I've also never heard anyone argue that someone else should configure some different tab width, is there a specific language ecosystem you were in that had these insane takes?
- ben-schaaf 1y ago
- chrisweekly 1y agoThe choice isn't (tabs) vs (spaces). It's (tabs && spaces) vs (spaces). In the real world, there will always be spaces, whether used for indentation or not. Using tabs for indentation inevitably leads to a mix of both - which is, objectively, worse for maintenance and consistency.
- PaulDavisThe1st 1y agothe correct rule is: tabs to indent, spaces to align [TAB][TAB][TAB]ShortTypename[SPACE][SPACE]variable_name [TAB][TAB][TAB]LongLongLongTypename[SPACE]variable_name2 ps. the [SPACE] counts above are illustrative, not accurate.
- g-b-r 1y agoExactly, just have your linter error out if there's a tab following a space
- throw-the-towel 1y agoThe correct rule is: you shouldn't align.
- hollerith 1y agoThe code I maintain (Emacs Lisp) follows that rule.
- TZubiri 1y ago
- hackthemack 1y agoIn the 90s, when I used various text editors like Ultraedit, Nedit, Pico, Nano, Vi, and my co-workers used Dreamweaver, Visual C++, Visual Basic, NetBeans I was in the "TABs are superior" camp but only for the initial indention of code blocks. But somewhere along the way, editors added features that let you see invisibles, and let you set up smart tabs so that you could hit tab, but it would interpolate 4 spaces (or whatever you set) into the document, and let you shift+tab back the indention or TAB the indention, but put in spaces. More importantly, the mass of people who all coalesced on using the same editor in the web development sphere, Sublime then Atom then MS Visual Studio Code, has made it easier to just say "set your editor to do this". I have changed my mind to using SPACES now because the editor lets me fake using TABS.
- efilife 1y agoSo it's the same as using tabs but you are actually using spaces for no real reason?
- frizlab 1y agoNavigation is still more painful with spaces than with tabs.
- DrSiemer 1y agoNot if you learn to use the right shortcuts for it (ctrl+arrows, mostly).
- frizlab 1y agoI know the shortcuts. (It’s not ctrl-arrows; ctrl-arrows is to switch Space.) There are still situations where it’s annoying, mostly when navigating the code using the arrow, moving from one location to another using the arrows, I won’t add a key modifier right in the middle of moving the cursor, it just doesn't make sense.
- DrSiemer 1y ago
- bbkane 1y agoThe most important thing is consistency. I've become a huge fan of deferring tabs vs. spaces debates to an autoformatter. Set it; forget it; argue about something else. This is most useful when applied ecosystem wide - no one in the Go ecosystem argues about tabs vs spaces, they just run `go fmt` (or more likely their editor is set to do that automatically) and move the #$@% on with life :) Fortunately for me, newer languages tend to include a formatter in the core install/editor tooling - Go, Rust, Gleam, Dart, probably more I'm forgetting... I think Go pioneered this approach and I'm glad others have taken it as well.
- kevin_thibedeau 1y agoAn autoformatter wont touch a tabbed ASCII diagram in the comments,
- arccy 1y agobut the autoformatter will have dictated the choice of space vs tabs for the file in question, an likely also the width of tabs (if any) for alignment. so you just need to follow the convention.
- kevin_thibedeau 1y agoThe whole point of preferring tabs is so you can customize the display. That can't work if tabs are used in fixed format text.
- justinclift 1y agoGo's autoformatter will absolutely screw up existing ascii comments when they randomly decide to change how the formatting works. As found the hard way when one day we updated the version of the Go formatter, and much of our nice comments needed to be redone. Thanks Go formatter team (yes, that's being sarcastic).
- GeorgeTirebiter 1y agoCompletely agree: tabs FTW. I wish I could find the reference, but when dealing with mono-spaced fonts, readability is apparently enhanced with THREE spaces per indent. Now, good computer people hate non powers-of-two, so it's either 1, 2, 4, or 8 spaces!!!! I guess I'm not a good computer person, because my eyes find tab stops at '3 spaces per tab' just right.
- Izkata 1y agoI remember suggesting it as a jokey promise over a decade ago, but got curious and tried it myself. It also seems just right to me, and is what I've used in all my personal projects ever since.
- frizlab 1y agoI have used tabs with a three-space width since forever, and it is indeed the better spacing.
- RGBCube 1y agoI also use 3 spaces myself, because 4 spaces is too damn wide and 2 spaces is a little bit too small. I would use tabs instead, but rustfmt doesn't handle it well at all in some of the nightly options, I've had it use spaces where it should use tabs a lot.
- rossant 1y agoTIL some people use 3 instead of a power of two. I would never had thought of it nor would I have considered it as a reasonable choice. And now I wonder why I would have thought that.
- no-program 1y ago[dead]
- notarobot123 1y agoThe original "tabulator" key was intended to save time and effort aligning text with spaces. With the ubiquity of decent IDEs that objective is unnecessary. I think there is a reasonable argument about the distinct semantic value of tabs but they introduce a concept that the general public think is superfluous when two spaces do the trick. Words can become obsolete if there are other more commonly understood ways of expressing the same thing. This seems similar.
- jl6 1y agoTabs are the modern choice, because you can then configure your editor so that for every tab character, it calls an LLM with the buffer contents up to that point, with instructions to generate an appropriate number of spaces that can then be substituted in. You might be thinking 2, 4, or 8, but the LLM will give you the contextually-correct answer.
- PaulDavisThe1st 1y agoLLM? Emacs has been doing this for decades without any such technology.
- g-b-r 1y agoEmacs can let a butterfly flap her wing, causing momentary pockets of higher-pressure air to form, which act as lenses that deflect incoming cosmic rays, focusing them to strike the LLM's memory; the LLM will then report the appropriate amount of spaces.
- kelseyfrog 1y agoConfigure your ^\s+ width if it's that important?
- throwawayqqq11 1y agoNow let the battle of how much spaces to use begin! Are you a superior 4-spacer or is that too much for your weak IDE on that 4:3 screen?
- deleted 1y ago[deleted]
- ta8645 1y agoJust define Tab as 1 space, and they can be used interchangeably. Peace in our time.
- IncreasePosts 1y agoNot if they're inside a string
- patrickmay 1y agoYou are a monster. I would like to buy you a beer.
- tfandango 1y agohe only drinks Tab.
- sidewndr46 1y agoWhy stop there? The tab nihilist would just define the tab to be 0 spaces. Then, tabs do not even matter
- em-bee 1y agothey still would in python.
- purpleidea 1y agoTabs are the preferred, more efficient and more accessible format, and most people know this. Every golang dev loves just having one tap to indent code, and nobody loves the constant repeat rattle of space indented code. Seriously though, tabs let you pick what's visually easier for you to read and I've worked with coworkers that struggle when indentation isn't clear.
- devnullbrain 1y ago>nobody loves the constant repeat rattle of space indented code. It's hard to view your opinion as unbiased when you think this is how people indent with spaces.
- deafpolygon 1y agoI've always been team Tab. I prefer tabs, even in my CSV (actually, TSV) files. But everyone else has decided this for me and I have begrudgingly adopted spaces. Even though Tabs can be set to whatever anyone wants at no switching cost to anyone else. Imagine if Python used actual Tabs.
- konart 1y agoThankfully all the go code I'm working with has tabs.
- TheAceOfHearts 1y agoThis tabs vs spaces nonsense debate has gone on way too long, mostly because people cling on to terrible legacy text editors. Any modern text editor should allow you to write a simple plugin to display tabs or any combination of leading spaces as whatever indentation amount you prefer. Projects should just pick whatever standard is most popular for their given language, and then people can tweak their editors for personal preferences. If you encounter a lot of code on the web then you might consider writing a browser plugin.
- Avshalom 1y agoThe real war is between people constantly aligning and formatting things in their code and people who just want to know which bits are inside the loop.
- _hao 1y agoBullshit. Tabs are the only sane choice and I don't care what anyone else says.
- indycliff 1y agoWhat would an LLM choose... guarantee it's a tab
- jahewson 1y agoTabs are for tables. Change my mind.
- kmbfjr 1y agoNot only that, just wait until they find out there is a vertical tab.
- jfengel 1y agoHow about "neither tabs nor spaces, and set your editor to indent according to the syntax rules of your language"? It doesn't work for indent-sensitive languages like Python, but it works for most of the other major languages.
- owlstuffing 1y agoThis is yet another reason why source code sb stored in parsed AST form.
- exiguus 1y agoThis makes me smile. All the hard work to look up the defaults. Personally I prefer that the CI Workflow enforce whatever is chosen.
- dimava 1y agoEdit: it got fixed, thanks to the author I think with majority of TypeScript projects using Prettier, 2 is more likely to be the default[0] The linked page literally says to ignore it [1] > STOP READING IMMEDIATELY THIS PAGE PROBABLY DOES NOT PERTAIN TO YOU > These are Coding Guidelines for Contributors to TypeScript. This is NOT a prescriptive guideline for the TypeScript community. 4 is a historical thing used as a default for all languages in VSCode [2] [0] https://prettier.io/docs/options#tab-width https://prettier.io/docs/options#tab-width [1] https://github.com/microsoft/TypeScript/wiki/Coding-guidelines#style https://github.com/microsoft/TypeScript/wiki/Coding-guidelin... [2] https://github.com/Microsoft/vscode/issues/41200 https://github.com/Microsoft/vscode/issues/41200 Edit: found the TS style guide at https://github.com/basarat/typescript-book/blob/master/docs/styleguide/styleguide.md#spaces https://github.com/basarat/typescript-book/blob/master/docs/... , it should be the correct link P.S. did send a mail to author hopefully they fix it
- jeffrallen 1y agoThe fact that Go = tabs is just one more good reason to use it, in my book.
- tfandango 1y agoMy favorite things about the Tabs vs. Space war is that you can't even reference it without igniting it.
- ChrisArchitect 1y agoObligatory Silicon Valley HBO clip on Tabs vs Spaces: https://www.youtube.com/watch?v=oRva7UxGQDw https://www.youtube.com/watch?v=oRva7UxGQDw
- Quitschquat 1y agoHow about flexi spaces? Best of both worlds. Set you space size.
- DrSiemer 1y agoMeanwhile, the war on tab width marches on. Back when I got tired of inconsistent tab widths, I simply based my preference on the silly fact that some research showed how developers using two spaced tabs make slightly more money. Among our team we do not enforce a specific width, but respecting the choice of the original author of a project is required. Kind of annoying how LLMs will sometimes randomly decide to change tab width.
- helf 1y ago[dead]
- binary132 1y agoI would humbly suggest that something like “lines of application code ever written”, or better yet, “source code files evaluated since Unix epoch [or “per second” if you prefer]” is probably a better metric. I think in that analysis, you would find that tabs are more than holding their own.
- dusted 1y agoIt's slightly insane that computer programs are still mostly derived from plaintext files.. but what's absolutely insane is that we, the people creating those programs, do so by modifying individual characters in those very same plaintext files.. Yes, text is a good interface medium for exchanging program descriptions between humans and machines.. but it's not a very good medium for storing and exchanging program descriptions from machine to machine, or even human to human.. Humans have opinions, sense of aesthetics, habits, and so on.. some more than others, but still, most people care about at least some part of the.. non-important-to-the-actual-program-compiling stuff, such as casing, indentation, placement of brackes, variable naming and so on.. all stuff that's there for the humans, the compiler don't care what you name your variables.. It's insane that there's no abstraction here.. Just think about how much code we've written to wrangle characters in text files.. formatters, beautifiers, linters, preprocessors, templating systems, lexers, compilers.. It's natural, the amount of development invested in this, and the, honestly, pretty good tooling we have to manipulate those individual characters in files, makes it seem like the only way.. But it shouldn't be.. We should be able to describe programs by typing text, but the text shouldn't be there both for us and for the machine, it should be there only for us, the machine should present text to us, that describes the program, but we should be in control of how that is presented to us, far, far beyond choosing a color scheme in our glorified typewriter emulators. I should be able to tell my programming editor how _I_ want things presented, and that presentation should be a setting in _MY_ editor, not something that has any effect on the program descriptions I'm working with.. Like, the browsers default stylesheet in an alternative world where HTML only described what, and didn't allow the webmaster to overwrite the style. Power to the user. If I wanted variables to be blue and blinking, and I want the function keyword to be a fire emoji, that's on me, that's just presentation.. We shouldn't have directories with plaintext files as our program storage, we should have dedicated program description files, and we should have dedicated tooling to work with them.. We will never have that.
- g-b-r 1y ago> variable naming and so on.. all stuff that's there for the humans, the compiler don't care what you name your variables.. It's insane that there's no abstraction here.. You would have variable names not saved? They don't matter for the future maintenance of the program? You can have most of what you ask right now, the further step most relevant here would be to not indent anything in the saved code; with most languages you're free to do it, and it's feasible to have an editor display it with the indentation you prefer; however it could only make sense if there's no way to have your team agree on an indentation style, there's too many fldownsides with hardly any advantage otherwise. You're always free to have your editor ignore the spaces and display the code the way you prefer, anyhow. But it's probably not always possible to deduce how things should be aligned.
- tabs_or_spaces 1y agoFinally, I've been battling with this for ages!!
- deleted 1y ago[deleted]
- Brajeshwar 1y agoI’ve also been tinkering around with AI-Coding assistants, having fun and learning many of the missing steps from my career. As someone who loved to write codes that are well formatted, well named, and well organized, the one thing I hate about AI-Coding is the fomattinig mess. So, the first thing I do now is to set `.editorconfig`[1] and add an instruction as part of the process to respect it. btw, it still ignores it at times. Of course, long back, these are also the first things I did so the team can reduce fights and let them choose their own tab-to-space preferences. The other thing was to set up `.gitattributes`[2] early on, specially for those on Windows, to commit the correct attribution when pushing to git. 1. https://editorconfig.org https://editorconfig.org 2. https://git-scm.com/docs/gitattributes https://git-scm.com/docs/gitattributes
- wormius 1y agocommas.
- em-bee 1y agoem-dashes
- wodenokoto 1y agoWhen I started programming in Python I was all like “why do they even allow tabs?” But now I’m like “why did they ever allow spaces?” Space indentation is only nice if your editor has all sorts of weird logic to handle spaces at the beginning of a line as though they where half or a quarter as many tabs. Just use tabs!
- donatj 1y agoHear me out - tabs are better because there is no possibility of invalid indentation state. "Make invalid states unrepresentable" and all that, If your style rule is 4 spaces, you have 3 invalid indentation levels for every valid one. Even if you only use two spaces half your possible indentation levels are invalid. The number of times in my life I've been editing a space-indented file in vim on some sshed server and had to count spaces is way too high.
- burnt-resistor 1y agoDespite the triumphal declaration, bikeshedding flamewars over superficial minutia will continue because that's human nature.
- TZubiri 1y agoI didn't hear no bell
- cowboylowrez 1y agoI would like to congratulate my fellow space using elite on our complete and total victory. I'm also now considering how to use the now empty spot in the ascii chart, I'm thinking we can use tab as an alternative pipe character as I'm tired of hunting for the existing pipe key with every friggin new keyboard I buy.
- hiAndrewQuinn 1y agoOne of the best side effects of a space victory is that Tab Separated Values are a much nicer format than Comma Separated Values if you aren't bothering to use a proper library since \t appears materially much less often than , in most datasets of interest. (Which you should but, you know, just in case.) Just my two cents.
- TrnsltLife 1y agoTabs are better