Let's settle this

Let's settle this
strawpoll.me/12588564

Other urls found in this thread:

esolangs.org/wiki/Whitespace
youtube.com/watch?v=SsoOG6ZeyUI
twitter.com/SFWRedditGifs

>2 space tabs

THIS D E S U

>2 space
I've always preferred 3space, but since they're tabs they are completely subjective to the individual developer's tastes and that is acceptable.

>Using indentation at all

Tabs, duh.

spaces since unix displays tabs as eight spaces

Why not both?

For you:
esolangs.org/wiki/Whitespace

FORTRAN was right all along

Considering every editor worth thinking about is easily capable of converting between the two and displaying tabs as as many spaces as you want, this discussion is literally irrelevant. Have your editor convert every file to your preferred style on open, and convert it to the project format on save.

Tabs, because there's literally no reason to use spaces. And you can set the width of a tab.

pros for tabs:
no reliance on editor for indenting/deindenting.
Some editors get confused as to what actually is an indent, when you use spaces for alignment
pros for spaces:
opens the same on every editor.

There is not benefit to using either; just pick one and consistently use it throughout the project.

I use tabs that are 8 spaces in width. They are very visually distinct, which I like.

The only reason not to use tabs is on like ancient terminal modes which have special rules for either. There was a period where tabs were haram, that period is long over.

That's going to fuck shit up if you use git. Having to swap between tabs and spaces every time you do a commit is annoying as hell, but it's easily possible that your editor will fuck shit up and pollute your commit with little whitespace changes.

Just use whatever the project uses. Neither have enough of a benefit to be worth the pain in the ass of constantly switching.

I find that a lot of editors don't handle backspacing tabs very well. A lot of them require me to hit backspace 8 times to get rid of my space-tab. I don't see a reason to use spaces instead.

There's always the possibility of a git-local .vimrc or whatever. I'm not sure what configs exist solely for writes and not for editing though.

Sounds like you're editing wrong, that's the exact reason to use tabs so you don't insert spaces but rather columns of whitespace as a single character.

I suppose that's always possible. It seems like it's violating the KISS principle though.

>that's the exact reason to use tabs so you don't insert spaces but rather columns of whitespace as a single character.
That was a typo. I mean to say:
I find that a lot of editors don't handle backspacing tabs very well, when you use spaces as tabs.

>assign project commit button
>auto changes whitespace before saving or committing
>wow_so_hard.jpg

>violating the KISS principle
Something is probably going to fuck up and you're going to wind up cleaning up some unintentional white space changes every now and then. All because you're too autistic to just use the project standards.

Git is often set up to automatically change line endings when using windows. No reason the same couldn't be done with spaces and tabs

two spaces
>two spaces
>TWO SPACES
>TWO SPACES
>T
>W
>O
>S
>P
>A
>C
>E
>S


ree.

I do not understand how you can use 8-space tabs. It makes code unreadable. 4-space is best desu, but I use 2 when writing in seeples for obvious reasons.

have fun aligning things with other things tabfags

Only REAL developers use 4-space tabs for everything.

So I can align useless variables and my knack for over-commenting my code to death?

Why would you ever use spaces. If you're really worried about formatting literally every text editor is capable of converting tabs to spaces.

related
youtube.com/watch?v=SsoOG6ZeyUI

tabs for indentation
space for alignment

it is the only true way

spaces, because I'm tired of tab = 8 space on anything that isn't under my control.

so fuck it. the only time i need hard tabs is for

>hitting spacebar 4 times

this is retarded.

There's also no reason you couldn't just not be autistic and use the standards for whatever project you're working with.

There is nothing to gain here by not just following the project specifics.

To be fair, they are using macs.

If they were using Lenovo X220s, they would both have configured their operating system of a text editor so that they never had to hit spaces at all.

>so that they never had to hit spaces at all
jesus how the fuck did I type that

\r is literally invisible in 99% of text editors

spaces and tabs have width, and git would have to make a decision that tabs or spaces are king. It's easy to make that decision (\n > \r\n in all cases) for carriage return vs. line feed.

That being said, tabs are better due to their ability to be customized. Tabs > spaces will almost always work fine. Spaces > tabs can get tricky as you are removing data.

>\r is literally invisible in 99% of text editors
fun fact: if you don't use CRLF endlines, batch files can break in bizarre ways.

>That being said, tabs are better due to their ability to be customized
That can lead to alignment problems in the codebase. You really should just stick to one tab size.

Tabs that convert to 4 space

some form of s/^\s+/\t/, so hard.
>/^{4,}\s/\t/g

If you do that, it can unintentionally cause whitespace changes and fuck up your commits.

Could, or you could just write it in some git config and do it that way. Either way it's not anything close to catastrophic. It's incredibly simple.

that fucks up my aligned multi-line array literals

If you do it in the git config, can you make it automatically prevent unintended whitespace changes? I've never had a reason to use anything like that in git.

I don't know if you can currently do that in git but adding it would be trivial.

That was just some top of my head regex examples, you could very easily ignore newlines but keep ^ and negate it within matched braces and quotes or whatever.

>matching braces with regex
wat

Not sure either, but I have to use 8-space tabs for Linux kernel development.

oh boy you're going to make me flex them regex muscles huh, I'm going to try to remember all this without a reference and no symbol-matching editor.
>/(("({4}\s)+.*")|(\(({4}\s)+.*\))/\t{icantfuckingrememberthis}/g

Okay so in a single raw regex that's going to be non-trivial, but there are other trivial options

Oh those are supposed to be (?:)'s too

lol we need this guy on our startup

Since array literals can be nested it's literally impossible to correctly match them with plain regex.

It seems like a waste of development time for the git people

tab + 4 spaces + text;
if you converted to 4 spaces in place of a tab would become
8 spaces + text;
then if you converted back to tabs, this would become
2 tabs + text;

If one dev uses 8 space tabs, mixes tabs with spaces for optimal alignment and the other uses this hack to do 4 spaces, this case will fuck up.

a lot of regex implementations have pushdown automata computational power.

It would be something, alright.

Mixed tabs and spaces would be grounds for dismissal, of course. I thought that went without saying.

sed's is pretty limited though

Yeah, sed's trash all around. psed exists but is broken in half the packages anyway. I don't even remember what else has real PCRE but they exist.

To be fair if you find yourself having to match nested structures you should stop using regex oneliners anyway.

mixing tabs and spaces will give you optimal alignment. You can't edit code
with a different tab size because it'll fuck up alignment, but having multiple developers using different tab sizes is going to fuck other things up anyway. I set my max line length at 80 characters in my projects, so I can split screen easily; if someone's programming with 4 space tabs and I open with 8 space, they're going to go over the limit.

Just set one standard for the entire project and stick to it. don't be a snowflake.

If your feature requires you to strictly use only tabs or spaces, it's not very good.

I don't code, so I don't know the ups and downs of this, but spaces looks better tbhfam

Hah yes, loooong before that point.

>alignment
first, who gives a fuck about special snowflake alignments? second, if they are deemed NECESSARY they can be annotated and worked around easily.

>special snowflake alignments
I align certain elements of my code because it makes it quicker to read. I use it for the same reason that I don't create thousand line procedures.

The more pressing concern is maximum line length. That's really fucking annoying to deal with; line wrapping is hard to read.

Whitespace alignment is never correct.

How do align things without any whitespace?
add shit like "/******/" between them?

I guess you wouldn't, or you would just use tabs and newlines.

Tabs and newlines are whitespace.

Correct answer. Though Elastic Tabstops is also cool.

Tabs are like schrodinger's whitespace, they aren't whitespace until they are interpreted. Newlines are most certainly not whitespace at all.

You're wrong.
Please look up what whitespace is.

This thread has made me see that nobody on Sup Forums works in the industry.

set tabstop=0
newline is a non-character formatting notation which is none space.

white space just means its a character that represents horizontal or vertical space. what consequences they may or may not have in say a programming language is a totally different issue.

5-space tabs. It's how I indent my regular writing anyways and is just personally aesthetically pleasing.

Right, but \n doesn't represent space. It represents position.

It still creates space between characters, making it whitespace.

So does' ', it shifts the position to the right instead of down.

As interpreted, perhaps. The behavior is not dependant on the character but the interpreter.

That's true for any character.

Except that most characters have unambiguous interpretations. \n is not the same as CRLF. Space is always space, tab is god knows what. Control codes are not the same as characters.

>You really should just stick to one tab size.
What he means is that it's easy to tell you editor how wide a tab should be, and instantly the code is indented at your preferred width.

It only breaks if some retard throws in spaces somewhere, which is retarded.

>using spaces
>import someone else's code
>they were using tabs
>IDE automatically converted each tab to spaces such that they are aligned to 0 mod 4 on the char count of the line
>some alignment problems for custom-aligned things, but they are clearly and immediately visible

>using tabs
>import someone else's code
>they were using spaces
>IDE doesn't do anything, code looks fine
>continue coding using tabs
>open code in another context (such as in a browser)
>code alignment is a catastrophe
>google for option in IDE to automatically convert spaces to tabs
>no such option exists
>manually write regex script
>normal indent alignment is fine, but everything else is fucked

Yeah, I'm sticking to spaces.

I don't understand, tabs are superior in both parts of that story, why wouldn't you accept them? In one they don't harm spaces-users, in the other spaces users harm tabs users? There's literally no harm in using tabs but great harm in using spaces. Are you intentionally writing malicious metacode?

In reality, if you stand in front of a bulldozer and say "no, you move", you get run over. A flower that needs to be protected is not a superior organism, it's just an affectation.

>not using 1 space tabs (everywhere)

That attitude really violates my code of conduct.

Elequantly put user. Are you a writer?

4 space tabs mah {{ pic }}

For C-likes with no universal convention: smart tabbing (tabs indent, spaces align)
For everything else: go by convention

For HTML: No indentation for whatever gets sent to the client. Save bandwidth. Let the template code be readable.

You gotta pick your battles, man. If I were saying "I refuse to optimize my algorithm growth because it interrupts my workflow" that'd be different, but choosing consistency over indentation-resizeability is a cost I'm willing to accept. We use monospaced fonts for a reason, after all.

>It only breaks if some retard throws in spaces somewhere
It also breaks if I want a maximum line length. If two people are coding on different tab sizes, one is going to go over the line length limit.

A line limit of 80-100 is necessary if you
want to view your code in split screen on
a 1080p monitor. Otherwise you get line wrapping, which is really hard to read.

That's not true at all though because a tab is a single character. What DOES break is your interpretation of line length.
>80 character tabs
>can't ever code anything
If your work is suffering from YOUR PERSONAL indentation setting then that is entirely your own damn fault.

>In reality, if you stand in front of a bulldozer and say "no, you move", you get run over
And then the bulldozer driver is charged with second degree murder.

>If your work is suffering from YOUR PERSONAL indentation setting then that is entirely your own damn fault.
You're making the exact same argument I was making for why you need to force the tab size for all developers. If the tab size is 4 and some idiot uses 2, that's going to make everyone else's code go over the line length.

What? No, are you insane? If someone uses a 20 length tab his lines are going to be super short and it will affect no one but himself.

>the bulldozer driver is charged with second degree murder
I think it would be considered first degree murder in that case. The driver would have to have made a concious unprovoked decision to kill the man.

You still have to manually line wrap your code when you write a really long function call. It'll look weird if you start line wrapping way earlier than you should.

Standards exist for a reason.

A character like \x81 is not unambiguous at all.
They are all codes, and every one of them is dependent on how it's interpreted.

It'll look weird and break nothing but apparently your pride.

Q isn't ambiguous in any encoding.

it's hexdecimal, genius

It's hexadecimal and Q. Probably also some asian thing, but they're all the same as interpreted everywhere. You could create some context in which it would be ambiguous what it meant but in the context of any text encoding, it's completely unambiguous.

Four-space tabs are superior in C-like languages

Two-space tabs are good in Ruby-like languages