Open gadenbuie opened 2 years ago
https://www.reddit.com/r/javascript/comments/c8drjo/nobody_talks_about_the_real_reason_to_use_tabs/
- i created a new repository, and thought i was being hip and modern, so i started to evangelize spaces for the 'consistency across environments'
i get approached by not one, but TWO coworkers who unfortunately are highly visually impaired,
and each has a different visual impairment
one of them uses tab-width 1 because he uses such a gigantic font-size
the other uses tab-width 8 and a really wide monitor
these guys have serious problems using codebases with spaces, they have to convert, do their work, and then unconvert before committing
these guys are not just being fussy — it's almost surprising they can code at all, it's kind of sad to watch but also inspiring
https://www.reddit.com/r/javascript/comments/c8drjo/comment/esm8hl0/
I think this is less an argument for one over the other, and more of an example as to why nobody's conclusions will always work, all of the time, for everybody. Your team's style guide should be tailored to meet your team's needs. The point is to make the team efficient, after all.
This is interesting to me. I'm also a blind programmer. I use good indentation religiously, because my screen reader indicates the indent level with audio tones. This makes it very easy to track nesting, just as indentation does for sighted people. The way this indicator works is based on white space, though, so two four-space tabs and eight actual spaces are the same level. The problem is that the audio tone is meant to change when the indentation changes, and two tabs is different from eight spaces. Thus, I hear the tone when moving from one line to the other, even though they're at the same level. Thus, white space consistency is the key for me.
I’m a blind coder. I work mostly in Python, PHP, and JS. I work on code with two other developers, but rarely have interactions with code outside of my job. I use a screen reader, NVDA, that indicates indentation audibly. I thus find it very helpful to have good indentation, be it done with spaces or tabs, for tracking nesting.
I find this debate interesting. I prefer tabs, because there are far less of them to arrow past if I’m at the start of a line and need to get to the start of the text, past all the white space. However, with Nano and Notepad Plus Plus, this isn’t a problem. The Home key can jump between the two points on the line, so at worst, I have to press Home twice.
Tabs are easier to remove, since you have to backspace only once, instead of two or four times for spaces. However, in Notepad Plus Plus (my editor of choice), shift-tab will outdent. This also means that both are easy enough to work with when you want to change the level.
Tabs are faster to insert than a bunch of spaces, but NPP will handle that as well. It auto-indents most of the time, and I believe the tab key can be set to insert a set amount of spaces if I want it to be.
I prefer tabsfor the reasons put forth by OP. I’m the only coder on our team with special needs, but because I have those needs, I know what it’s like. I’d rather we be more inclusive, ready to accommodate a new hire who wants to change the tab width, than that we adopt spaces just so we can align variables based on the variables’ names.
Actually, that still confuses me. Do people really do that? Do they indent a different number of spaces than the code base’s indent level, just to line words up perfectly? Why would you do this and not just use indenting? What happens when a variable changes, or you have to add a new one? How and why is this a thing? Do I not understand what’s going on?
From prettier issue:
Here's some mindset framing that I think is really important in discussions like this:
- Who is being harmed / negatively impacted / excluded?
- Who is the most vulnerable and should have their experiences centered?
In accessibility conversations, the people that should be centered when coming up with a solution, are people with access needs. In this conversation, the people that should be centered are those who need configurable indentation widths.
There are clear reasons and major benefits for
useTabs: true
being the default that should outweigh personal preferences for spaces over tabs. 💖
When it comes to people with disabilities, they can use tools and plugins that present spaces as intentation in a more compact format.
stylemistake this is asking disabled people to do more work when we already have less time, energy, etc. to do more work. The point of accessibility is to reduce access barriers, not require or reinforce them. By using tabs instead of spaces, we enable people to customize their reading experience without affecting the underlying code. By enabling a more accessible reading experience, we lessen barriers for people that rely on code being readable for them to do their jobs. There are many resources out there about why tabs are more accessible than spaces. Please read them if you haven't already.
I believe that we accessibility advocates need to pick our battles. It would be nice if the world prioritized accessibility for minorities above convenience for the majority. But it doesn't, and it never will. It will always be necessary for us disabled people to adapt to the world as it is. We should accept that, and save our advocacy for problems that we can't easily work around. That way, when we do advocate for an accessibility accommodation, particularly a costly one, people will know that it really matters. Everyone knows the fable about the boy who cried wolf; we don't want to be perceived as being like that. Yes, I've failed to exercise this kind of restraint in my advocacy; I'm sorry for that, and now that this discussion has clarified my position, I'll try to do better.
mwcampbell Accessibility isn't a nice-to-have. Accessibility advocacy, and advocacy in general, isn't about accepting things the way they are. It's about challenging the status quo even when it's uncomfortable. I don't care how people perceive me for being a strong advocate for accessibility in every opportunity I get. It's also not my business or my problem how people perceive me (unless I'm actively doing harm with my actions and/or words). I'm don't do accessibility work to cater to the egos and feelings of non-disabled people. I do it so that the disabled people who come after me hopefully have it a little easier than me and my disabled peers. You totally have the option to do as you please here, but please don't police or demean how other disabled accessibility advocates choose to do their advocacy.
Rich Harris on Twitter: "TIL Prettier is considering making tabs the default in 3.0. This is huge — it would make an entire set of programming languages more accessible (if you're somehow still pro-spaces, read this comment to instantly convert), and, more importantly, vindicate my personal preferences https://t.co/MYxY5wYLI3" / Twitter
Garrick Aden-Buie on Twitter: "I've used two spaces for ever but my mind was changed by this tweet. Tabs are actually better. Oh and it's now the default in {grkstyle}, making it easy to switch yourself! https://t.co/CzYQkwR6xy https://t.co/owAB4Tmw7O" / Twitter
https://alexandersandberg.com/tabs-for-accessibility/
--preserve-tabs
Travis Dawry on Twitter: "@grrrck Just a heads-up for anyone working with @quarto_pub, tabs are converted to spaces by default, but this can be disabled for code with the 'preserve-tabs' flag. Tabs in the notebook are always treated as spaces!" / Twitter
Use tabs by default by gadenbuie · Pull Request #7 · gadenbuie/grkstyle
feat: Follow RStudio indentation settings by default · gadenbuie/grkstyle@ce5cedc
grk_style_*()
text, file, directory and package styling functions will now follow the tabs or spaces settings from the RStudio project file. You can choose this setting in the Code Editing panel of the Project Options settings.Added
grk_reindent_auto_*()
to automatically re-indent text, file, directory or package code according to the RStudio project file setting (or thegrkstyle.use_tabs
global R option).https://support.rstudio.com/hc/en-us/articles/200526207-Using-RStudio-Projects
Managing your tab size rendering preference - GitHub Docs
Elastic tabstops - a better way to indent and align code