Tabs vs Spaces

code-editors
Tags: #<Tag:0x00007fbca73d72a8>

#41

Did you read the actual post? They controlled for that and saw the same effect. (Or are you referring to how certain languages were excluded from the chart? Did anyone run the numbers themselves from the survey data without a filter?)

Where are you getting that? I don’t think the SO survey asks about typography. (I may be missing a joke. :slight_smile:)


#42

By people on both Reddit and HN.


#43

I ran it without the filter. Here’s every language from the survey.


#44

Elixir salaries are going pretty well by the way! :lol:


#46

But now we have half of a year later. I wrote and read code written by many people. waded through formatted source code of many kinds (manually vs. tool) and I came to a conclusion at about year change and I am in a transition phase since then.

I migrate slowly to use tabs for indentation and spaces for alignment. At least when I have the choice. For languages that have an official formatter or projects that use a style guide I adhere to those though (even when I am not always the same opinion as those guidelines or tools :wink: ).

@OvermindDL1 already did his point about this in Tabs vs Spaces and I do understand it fully after using that style experimentally for about 3 months now in some C++ code I am hacking at for internal usage.

At least I will stick to this until elastic tabstops get proper support in the tools I use (emacs and VS code) and are not formatted away by the toolset I use (eg. mix format or go fmt).


#47

Obviously haven’t worked with GNU source code. Tabs have to be fixed to render 8 spaces.


#48

Why? Who forces me to do so? Who does even realize if I render it with a width of 2 locally or maybe 3?


#49

Nobody is forcing you to. Problem with the GNU style is that your tabs have to be set to render 8 spaces so that alignment in the source code looks right. Reason is code is indented with 2 spaces but every 8 spaces are converted to tab characters. So if you don’t set you editor to convert every 8 spaces to tabs (not 4 or 3 or 2), then code just looks misaligned. I contributed a tiny change to gcc libstdc++ a long time ago but spent a disproportionate amount of time reading the code and I remember thinking how crazy the GNU style was. For example just

wget https://raw.githubusercontent.com/gcc-mirror/gcc/master/gcc/c-family/c-semantics.c

and open the file in your editor. If your tabs are set to render as 8 spaces then indentation will look right. If not then things will be misaligned.


#50

Well, this falls under mixing tabs and spaces for indentation, and this is what I consider bad style. If there are consistently used only tabs for indentation and spaces for alignment, the actual tabwith will be irrelevant.


#51

To be honest, I see so benefits for educational reasons as well:
You can teach the difference between alignment and indentation.

As always, is it important to be explicit about everything, especially as newbie. To mix up alignment with indentation leads to a lack of understanding about both concepts, since it seduces you to assume that both is the same. :wink:

I will do this so now, thanks a lot ^-^


#52

Hmm, that is not really something I distinguish, but that is good to focus on… I’ll do that. ^.^


#53

So, is it unimportant to distinguish?
You might be probably already used to it, or?
Without teaching what is what, how to tell what is indentation?
Oh I see, you use languages which are not indentation significant :smiley: