Follow

When I write code, I prefer...

@fribbledom Since I kinda code in Haskell I use spaces, so spaces i guess

@fribbledom can't help feeling.... this is going to start a war 🤣

@fribbledom Can you send the results of this poll to me so I can block anybody who votes on spaces

@fribbledom tabs for indentation, spaces for spacing

doing it any other way is bad from an accessibility perspective

@ky0ko @fribbledom if that's because you can resize the tabs, you can either resize the tabs or have a maximum line length. Using tabs while expecting the user to be able to resize them in the editor breaks line length

@romariorios @fribbledom for someone with vision impairment or who is blind, the line limit is less of an issue - either because they have to resize the text to be too large for a line to fit on their screen anyway, or because they aren't even using a screen

for these users tabs are a better option, because the person with vision impairment can adjust the indentation so they can at least see the beginnings of all the lines with their large text size, and the blind user can have indentation read out to them

@ky0ko @romariorios @fribbledom i'm not blind, i'm just old, and i work with a bunch of younglings, so when we connect to the same tmux session, my giant font size wins, and suddenly their terminal window shrinks to half the size.

but, other than space, the reason i prefer shorter lines is simply that i struggle with comprehension…

same with a christmas tree of nested loops and if-elses.

@ky0ko
Is there something about tabs that makes it easier to have a screenreader read them out than spaces?

I mean: When indenting by spaces, you'd usually have some fixed number of spaces to use for indentation, so the number of spaces tells you where you are. Python interpreters always know the current indentation level, and that#s just a number, independent of spaces/tabs.

(aside: I know someone who'll happily indent by some variable number of tabs...)

@romariorios @fribbledom

@fribbledom I hate this question because I have no idea what you mean. I press tab but my editor enters a few spaces and I've never thought to change it. If I were to code in notepad I'd prefer tabs because it's quicker to type but as long as I can just press tab and have my editor figure out the indentation for me I'm fine

@fribbledom I guess that's a long way of saying tabs but I don't really care

@BadAtNames @fribbledom that counts as "spaces." Everybody uses the tab key, it's just a matter of what you've set up the tab key to do in your editor.

@fribbledom when I write anything I use tabs. Poetry? Prose? All tabs. All the time.

@fribbledom the only language I use where "what I prefer" and "what the language code formatting tooling lets me get away with" intersect is C.

But when I'm using C, by gosh I use tabs.

@tomasino @fribbledom

what that says, with the addition that the ability to set tab width supports accessibility (ie, someone needing to use a huge font size might set a narrow width to keep more code in view)

@fribbledom I said tabs and dreaded that this was the "wrong" answer

@fribbledom both, depending on the language I'm using. Tabs for Go, spaces for most others.

@carcinopithecus @fribbledom it all goes to shit regardless where tabs are. If your goal with tabs is letting the reader of your code resize the indent to their pleasing, your code no longer has a fixed line length

@fribbledom My editor canonicalizes white space, writing leading 8 space tabs and making everything else spaces. I never think tab/space unless, say, I'm editing an ancient syslogd.conf file. :)

@fribbledom Poll is either/or
I use both. Intermixed on the same line.

There's nothing quite like the look on someones face when they find three tabs each with a different number of spaces not rendered within them :P

@fribbledom
spaces, though I know that from a p.o.v. I should switch to tabs.
I plan to make #2020 the year I go all tabs.

@fribbledom Tab or spaces depending on my energy levels. Emacs converts the tabs into spaces anyway, so it doesn't really matter. One tab is easier than 4 spaces to type.

@fribbledom whenever I open other people's code in emacs I start by highlighting the entire code buffer and pressing the tab key, which corrects all the indentation to my config, which in my case is: tabs.

spaces people are crazy and trying to thrust their particular # of indents on everybody else, flooding the whitespace with garbage for TTS to read, and forcefully pushing on a tradition of dreadfulness where changing an editor setting alone is not enough to fix indents to your liking.

@ben align? what do you mean by that distinction?

@thufie this animation from the elastic tabstops article is a pretty good demonstration

nickgravgaard.com/elastic-tabs

better than I can do with words

@ben oh?! like aligning comments at the ends of lines! I can see that, but I generally prefer comment blocks before code segments rather than alongside them so I don't get that issue as much.

What if we just switched to RTL after the line of code? (joking)

@ben
I want a Python IDE which can do this... May have to check out Komodo...
If everyone I worked with had this, that would solve the issue of mixing tabs and spaces.
@thufie

@ben @thufie
...on second thought: For everyone who looks at elastic-tabstop code in a different editor, it'd be all over the place...
The same goes for "tabs for indent, spaces for space": Unless you either know what a file uses or make them visible, it'll lead to confusion.
In such a case, converting tabs to spaces is the easiest, safest way to avoid mixing them, which is likely why spaces-only code is "the norm" so far...

@Mr_Teatime @thufie does your editor use a random tab size for each line or something?

@ben
What? why?
1: Another person on a "non-elastoic" editor using a different tab size, or expecting all-spaces code will have a bad time, even without elastic tabstops.
2: Any edits they make will of course not align nicely once I look at them back in my own "elastic" editor.
3: If you have an unknown mixture of tabs and spaces, converting to spaces is easier and safer than converting all to tabs.
@thufie

@Mr_Teatime The entire point of tabs to indent spaces to align is that any tab size works

I'm not sure what's going wrong here

@ben
Well, elastic tabs can be a different length per line, but a non-elastic editor wouldn't know about it. In a non-elastic editor, any ET code would also seem to use tabs for alignment and spacing, thus violating the principle.

Each system (all spaces / tabs indent, space align / elastic tabs) works in a homogeneous environment, but once you have mixed code, editors, settings and users, it can quickly become a mess. And if you're in a hurry, space-only is the quickest way to clean that up

@ben
... that's not an argument in favour of spaces, but an explanation for why they are everywhere.

Personally, I think elastic tabs coupled with decent code introspection, should be the nicest to work with, and most accessible -- but also the least robust in heterogeneous environments.

@Mr_Teatime "elastic tabs" doesn't exist

elastic tabstops and tabs-to-align-spaces-to-indent are the same concept

@ben
If you want to nitpick: I'm pretty sure it's tabs-to-indent/spaces-to-align, not the other way round -- though I'm sure *somebody* would appreciate it :)

And "elastic tab*stops*" are absolutely not the same as that.

Example:
input.fontbureau.com/info/
copy/paste the example code halfway down the page (starts with "void setup()") into a normal text editor -- does anything line up? It works in Komodo, btw.

@ben
Actually, I just did try elastic tabs in Komodo, and its pretty nice, until you want to continue a comment block past an indentation change in the code, or have a comment block start below a line which used smart indent (to align broken lines so they align with the last open bracket), and then things start looking weird.

I think this could use some more code introspection, is what I'm thinking
@thufie

Sign in to participate in the conversation
Mastodon

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!