[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Which do you use for indentation?

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 73
Thread images: 5

File: tabs-vs-spaces.jpg (126KB, 1440x679px) Image search: [Google]
tabs-vs-spaces.jpg
126KB, 1440x679px
Which do you use for indentation?
>>
Tabs, reduces keystrokes and for some reason it just sits better with me that it's a single character.
>>
Technically most people use spaces because of the fact that IDEs and some text editors just replace tabs with multiple spaces.
>>
>>59030587
>reduces keystroke
what shitty editor are you using?
>>
Tabs because they make it easier to select the correct indentation level and they can be configured to show x spaces by any modern IDE. I will grudgingly use spaces if the style guideline requires.
>>
>>59030530
both

I use Python
>>
I convert everything to spaces because IDE's convert tabs to spaces a lot better than they convert spaces into tabs. When I try using tabs, porting someone's space-justified code always creates a huge mess, sometimes one that's hiding until I start editing it.
>>
>>59030693
>When I try using tabs, porting someone's space-justified code always creates a huge mess
I fucking loathe this shit, because I have a really spergy attachment to using tabs and it always results in inconsistency when I'm modifying other people's code which just triggers my autism even more.
>>
Soft tabs
>>
>>59030530
tab for tabulations
space for space
don't use a number of spaces for one tab it does not make any sense and shouldn't even exist in the first place.
>>
Anyone who uses tabs should kys.
>>
>>59030530
I used to be a tabs guy, but IDE's and even advanced text editors allow you to hit the tab key to indent your code. There is a lot of formatting issues when it comes to tabs, as they can be rendered way too wide and they're a bigger pain to copy and paste. Not to mention most websites don't support tabs.

In all my IDEs, I can hit a single key stroke and it will properly indent anything. Even code I copy and paste from the Internet.

So tabs are obsolete now. But the tab key is still very useful.
>>
I click tab, I don't care whether or not the editor turns that into spaces or not, I just leave the setting at default
>>
>>59030530
Whatever the standard is for the project I'm working on. Who gives a fuck? Reformatting an entire project is quick and easy with any IDE. Stop with this dumbass meme thread already. No real programmer actually gives a shit.
>>
>>59030530
set tabstop=4
set expandtab
>>
>>59030530
>set tabstop=4
>>
I use spaces. Is it really that hard to hit the space bar 4 times? You can alternate thumbs if you need.
>>
>>59033391
Of course not but it's even easier to press tab once
>>
>>59033397
You have to reach all the way up there with your pinky when your thumbs are all but resting above where they need to be. If the tab key and the caps lock were switched then it'd be a different story, but it's much more ergonomic to drum on the space bar when you need to indent.
>>
>>59030530
I just let my editor convert tabs to spaces, so spaces.
>>
>>59033413
I'd say it's less effort to move my pinky a centimeter to press tab than to hammer the spacebar four times. Either way the difference is so fucking minimal this is a pointless argument.
>>
Tabs because I'm not mentally retarded.
>>
>>59030530
Tabs for indentation, spaces for alignment.

That way anyone can set the tab width the way he likes.
>>
Spaces, obviously. Who actually wastes the characters to put two to five spaces in to indent when literally one will do?

Plus, GHC bitches any time you use tabs, which is totally understandable for a language like Haskell.

Plus, it's easier to use spaces if you're vim master race. IDK about IDE shit, I think that's what windoze losers use.

Seriously, though, why do you need all that fucking space? Why would you want to push that next line of code all the fuck the way over there, when one whitespace is enough? Like, are you unable to recognize one character? if so, don't fucking code.
>>
>>59033450
Sometimes I forget that some people write code so that other people can understand it. I call those people weak, and foolish.

Making your code perfect is like making a woman orgasm. Obfuscating it beyond the point that anybody else would be able to understand what the hell it does is like putting a ring on that finger. Doing it in a way that actually optimizes the code is like making the marriage work.
>>
>>59030664
Oh boy it's the guy who knows a blub language that has non-trivial whitespace weighing in on the best use of trivial whitespace

KYS, what was Haskell too fucking hard for you?
>>
>>59033496
Tabs, just because I hate this guy.
Seriously fuck you guy.
>>
>>59030693
Why the fuck do you use an IDE? Are you a pajeet, a wincuck, or some other flavor of normie? Too good for the command line and vim?
>>
>>59031602
>all my IDEs

wow I didn't know you needed more than one piece of bloat to allow you to be a total retard
>>
>>59030530
Tabs. For alignment I use spaces. This way the indentation character has a semantic meaning whereas spaces are only used for separating tokens and increasing readability.
>>
>>59033562
What's it like to be a hothead who hasn't produced anything but thinks they're hot shit anyway?

Tell us!
>>
>>59032547
No real programmer uses an IDE. We use TEXT EDITORS, faggot. Your job is probably just looking up libraries and making sure everything looks nice, newb. Guess who writes those libraries? Real programmers. Fuck off with your memes, you meme.
>>
>>59033579
Lol u mad tho why u mad, did I strike a nerve mayhaps? Did I rustle a jimmy or two? Can you define how many jimmies I rustled recursively, faggot?

LOL haven't produced anything. It only works to talk that kind of shit when you're right! Too bad you're fucking wrong as hell, and there's no way you can shitpost enough to convince me otherwise, because I know how many people benefit off of calling my libraries in their gay little "projects", dumbass!
>>
>>59033605
>Im someone important beleev me!
>I also post on /g/!

Alright kid ;) be believe you.
>>
>>59030587
>actually typing out the spaces
>>
>>59033579
>hothead

I wish you could see me right now. Listlessly typing absolute shitposting on /g/ while drinking poorly brewed beer at 8:34am after a long night of no sleep, watching my main compile and hum and whirr, occasionally flicking at my soft cock poking through my stained boxers, sticking its useless head right between the legs of the lambda printed on the front of the shorts. Yes, I'm a paragon of angry emotion right now, rather than just typing one handed while considering, half drunk, whether or not to go to sleep now or to wait for this fucking shit to fucking compile. Whoop, there goes my temper again. Just flicking my dick, drinking beer... flicking the dick, typing. God, I'm so MAD with all these EMOTIONS that I HAVE!

Whatever get bent normie
>>
Spaces for Python and Python alone
Tabs for everything else
>>
>>59033538
>Someone using a non-meme language to get real things done.
>Screams KYS over internet because unemployed.

Yea sounds like the /g/ I know and love.
>>
>>59033642
Ah man you got me there! I totally thought I was like this 30 year old man who does stuff with his life and owns a house and who has been shitposting here for like 10 years because sometimes there's such a thing as too much jacking off, but you've convinced me, I'm a child and a loser, and I totally concede that you're better than me.

Post your github, you little dweeb, if you're not really afraid. At least post, like, 20 lines of code that you wrote, YOURSELF, that can't be publicly searched, that actually do something useful. Otherwise, you have no right to talk shit.
>>
>>59033549
I use spacemacs. Everything is allright.
>>
>>59031410
You first, dear.
>>
>>59033699
Nah, I don't give out information to known trolls and hotheads.

I don't need the hassle in real life from people like you :)
>>
>>59033686
Python's a meme. Has been for years, buddy. I ain't screaming shit, I'm sitting here drinking beer and shitposting while playing with my dick while compiling some distributed server software.

I'm hardly unemployed. If you're gonna try to insult me, at least come up with something that's true.

If you're gonna talk shit, post 20 lines of anything useful that you've written. If you can't, I call bullshit on you.
>>
>>59033582
>t. 12 year old pro-programmer
>>
>>59033722
Seriously? You can't pull up 20 lines of anything you've written that isn't some school project, something that could be found on google or Github, or Hello World? You're a fucking joke. Nobody is going to trace 20 lines of code to your name, idiot, that's why I asked. You're LARPing. GTFO this board isn't for you.
>>
I use both, either 1 tab or 1 space, depending on whether the indentation level is odd or even.

void fn() {
while (b) {
if (c) {
d++;
}
}
}


I think it looks pretty good.
>>
>>59033739
>tfw a 12 year old knows what he's talking about more than you
>tfw that 12 year old is actually 30 and literally grew up with this shit since his dad VPd for novell in the 90s

Have fun looking up that personal information, dumbass, I laid it all out for you. Hack me with your elite doxxing skills, you toy.
>>
http://pastebin.com/6CbPeYrf
>>
>>59033804
>he thinks being a 30 year old with the mind of a 12 year old is something to brag about
also, you're assuming the wrong anon, retard
>>
>>59033835
That's cute. Tell it to my bank account and my house, idiot.
>>
File: shutterstock_153928124.jpg (562KB, 1000x627px) Image search: [Google]
shutterstock_153928124.jpg
562KB, 1000x627px
>>59033818
that's what I fuckin thought
>>
>>59033866
0/10
>>
File: facebook.jpg (24KB, 499x499px) Image search: [Google]
facebook.jpg
24KB, 499x499px
>>59033888
>>
File: giphy(69).gif (2MB, 600x338px) Image search: [Google]
giphy(69).gif
2MB, 600x338px
>>59030587
>>
>>59030530

Here's something I've been thinking about, it would be nice if my IDE would handle tabs different based on identation level. For instance I'd like the first indent level to render tabs as 4 spaces, then second as 3, then all remaining as 2.

This would obviously not be visible for others, they'd just see tabs at whatever rendering length they've chosen.
>>
>>59034595
By IDE I mean emacs by the way
>>
>>59034654
I think you can do that in Emacs actually, since Emacs knows what indentation level it's at.
You just need to advice-function at the right place.

I won't help your insane quest any further, but good luck and have fun.
>>
>>59034680
Yeah coding it would be easy, just wondering if you people think it sounds useful.
>>
>>59033562
>using 30 print statements in your code instead of reading the memory directory with a debugger.
>>
>>59034595
That sounds like absolute cancer, why would you want this?
>>
>>59034930
Clearly you have never worked on anything where you can't just use a memory-inspecting debugger to solve your problems. Those that have tend to find debuggers just not all that useful anymore.
>>
I dont remember the last time I manually indented any of my code. A sane editor will automatically format it for you, which is additionally useful for refactoring code.
Also, tabs don't make sense in lisp so I use spaces. The idea of a "tab" just being X spaces in a single character is pretty useless. Even using non-leading tabs for "alignment" usually doesn't work and spaces are a better idea.
>>
>>59035013
Yes, not everything can be seen using the memory inspector. But the point is you waste tons of time doing shit that can be automated, meaning you don't have a job.
>>
>>59032596
you forgot
set softtabstop=4
set shiftwidth=4
>>
>>59033699
no u
>>
>>59030530
I'd probably use long arrows like ⟼ if font rendering wasn't retarded.
>>
>>59032596
/thread
>>
I'd use tabs for indentation and spaces for alignment, but I haven't found a comfortable way to make it work.
So I just use spaces for everything.
>>
>>59037513
>spaces for alignment
Absolutely disgusting.
>>
>>59030530

No idea.

I press tab and emacs does the right thing, whatever it is.

Also, if the language i am using has some 'idiomatic' conventions (go, python) i use the appropriate tool to format it (gofmt, autopep8).


Arguing about spaces vs tabs is moronic, what is important is implementing features, passing tests, getting shit done.
>>
>>59030530
Go with whatever conventions the project or language you're writing in uses. Python uses spaces, C uses tabs (usually)
>>
>>59038138
C has a lot of stupid conventions, like omitting braces for single-statement if conditions
>>
>>59038394
>like omitting braces for single-statement if conditions
That's not stupid. The stupidity is that braces are mandatory for single statement functions. That's incoherent.
Thread posts: 73
Thread images: 5


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.