← Home ← Back to /g/

Thread 106316568

31 posts 10 images /g/
Anonymous No.106316568 [Report] >>106316668 >>106316676 >>106316694 >>106316949 >>106316968 >>106317087 >>106317130 >>106317148 >>106318137 >>106318676 >>106319072
TABS
I generally don't mind tabs (still prefer spaces), but I have a question: how do you align things properly with tabs? I mean it looks fine on this screenshot, but it's only with my settings where 1 tab visally equals 4 spaces and I realize it may become all screwed up with some other settings.
Anonymous No.106316576 [Report] >>106316600
nigga, stop fucking bothering with this shit and use the tool "gofmt"
Anonymous No.106316600 [Report] >>106316615
>>106316576
Yeah, I will never usr gofmt, because I know what I wany my code to look like. I've explained it many times, it's not just autism, it's very practical too. If you don't get it fine, but then stop telling me to use formatters and linters.
Anonymous No.106316615 [Report] >>106316628
>>106316600
I remember being a noob too, like 12 years ago
Anonymous No.106316628 [Report] >>106316647 >>106316671
>>106316615
Anon, please. I've been doing this for 25 years.
Anonymous No.106316647 [Report] >>106316723
>>106316628
then you should be intelligent enough to know that your custom styling is a waste of fucking time, and hampers your brain's ability to process code when regularly consulting your own code as well as other people's code (which will be formatted via gofmt).
you should also be intelligent enough to answer your own question regarding tab + space alignment, which has been discussed endlessly in various locations on the world wide web.
Anonymous No.106316662 [Report] >>106316734
Irrelevant. The minute you dare submit code to my repo it gets auto formatted to my projects standards and you must comply or I deny your pull request.
Anonymous No.106316668 [Report] >>106316999
>>106316568 (OP)
why would one ever use tabs for alignment?
Anonymous No.106316671 [Report]
>>106316628
Not nearly long enough.
All cpm, unix, dos, windows, and c-compilers themselves all used tabs and is very readable.
The reason you wrong about liking that format is because you just got ahold of some bad training data when your brain was developing.
Overcome it.
Anonymous No.106316676 [Report]
>>106316568 (OP)


function(arg1,
arg2,
arg3);

function(
arg1,
arg2,
arg3);



Just do the second one instead. It works with tabs, supports different tab widths. Does not result in overly long lines.
Anonymous No.106316694 [Report] >>106316744
>>106316568 (OP)


function(arg1,
arg2,
arg3);

function(
arg1,
arg2,
arg3);



Just do the second one instead. It works with tabs, supports different tab widths. Does not result in overly long lines.
Anonymous No.106316723 [Report]
>>106316647
> you should be intelligent enough to know that your custom styling is a waste of fucking time

Ok, I'll repeat this one more time for you, although I know it's a waste of time, because I will not be able to convince you. Here's the deal: when you look at nicely formatted code it's easier to spot inconsistencies, bugs and other potential issues, it's easier to reason and udnerstand. Formatters can't automatically format code the way a human would, because they can't think about code, a formatter is just a very dumb tool. A human that writes code and cares about it will format it, so it looks nice and is a pleasure to work with. It's the difference between a carefully decorated room and and soulless condo. I don't understand people who work with code (for money or for fun) and don't actually care about what it looks on the screen, because for me it's part of the the whole deal.
Anonymous No.106316734 [Report]
>>106316662
That's why I don't submit it to your repo, ewww anon.
Anonymous No.106316744 [Report] >>106316846 >>106317732
>>106316694
That may work with tabs, but it's clearly very ugly.
Anonymous No.106316846 [Report]
>>106316744
Alignment sometimes looks good, but it often results in very right heavy code and long lines. The second syntax is just all around a better solution.
Anonymous No.106316949 [Report]
>>106316568 (OP)
tabs are for indentation, OP. not this.
Anonymous No.106316968 [Report] >>106317074
>>106316568 (OP)
Tabs for indentation, spaces for alignment.
Anonymous No.106316999 [Report]
>>106316668
>press one key
>get on with your life
Anonymous No.106317037 [Report]
I just use
function(
arg1,
arg2,
arg3
)

I'd do the same with spaces.
Anonymous No.106317074 [Report] >>106317331
>>106316968
nice font, what is it?
Anonymous No.106317087 [Report]
>>106316568 (OP)
I generally just prefer to write in a way where things don't need to be aligned properly to begin with.
Anonymous No.106317130 [Report] >>106318676
>>106316568 (OP)
This is how Linux kernel does it. They use 8 size tab characters.
Anonymous No.106317148 [Report]
>>106316568 (OP)
you don't. that's why tabs are shit.
Anonymous No.106317331 [Report]
>>106317074
No idea. I got that image from google
Anonymous No.106317732 [Report]
>>106316744
code is ugly. you should prefer readability over your subjective beauty. aligning code like in OP pic is mental illness but doesn't help you understand what it does.
Anonymous No.106318137 [Report]
>>106316568 (OP)
1 tab = 8 spaces. Follow this simple rule, and your code will look good everywhere, except on a tiny minority of malconfigured machines
>what if I want 4 space width indents
that's very easy. Every second level of indentation has four spaces on the end to round it off. Any other questions?
Anonymous No.106318676 [Report]
>>106316568 (OP)
>>106317130
>spacing with tabs
People like you are the reason why we can't use tabs
Anonymous No.106318765 [Report] >>106318961
Tabs are fucking weird, they’re a holdover from typewriters where you would configure the tabstops to allow you to quickly fill out forms and tables, but most software automagically determine how long tabs should be (only word processors really let you configure tabstops), and often times it’ll look good in one program, but then you open it in another and the formatting is all fucked. This is why spaces are preferred for alignment, because while tabs are convenient for manually aligning stuff, it’ll be fucked if you open it in another program, which rather defeats the point.
Anonymous No.106318961 [Report]
>>106318765
but tabs are for indentation. nobody told you to use them for alignment, anon.
Anonymous No.106319054 [Report]
>how do you align things properly with tabs?
Smart tabbing, which combines tabs and spaces. You don't assume how big a tab is in terms of spaces. You just know that they have the same width as every other tab. Two lines of code can be aligned only if they have the same number of leading tab characters. Spaces are used after the tabs to align text.
Anonymous No.106319072 [Report]
>>106316568 (OP)
it's just a strategy silly game
don't think much about it, just enjoy it