133
you are viewing a single comment's thread
view the rest of the comments
[-] CaptainPedantic@lemmy.world 16 points 3 days ago

I would die on the opposite hill. No spaces, only tabs.

What's your reasoning for liking spaces?

[-] JakenVeina@lemm.ee 7 points 3 days ago

My big reason would be "it hurts readability". That is, when writing code, readibility for others who aren't familiar with it (including future me) is my top-priority, and that means indentation and alignment are HIGHLY important, and if I spend the time to write code with specific indentation and alignment, to make it readable at a glance, I want to be certain that it's always going to display exactly that way. Tabs specifically break that guarantee, because they're subject to editor settings, which means shit like the below example can occur:

I write the following code with an editor that uses a tab size of 4.

myObject.DoSomething(
    someParameter:      "A",
    someOtherParameter: "B",
    value:              "C");

If someone pulls this up in an editor that uses a tab size of 8, they get...

myObject.DoSomething(
    someParameter:          "A",
    someOtherParameter:     "B",
    value:                          "C");

Not really a big deal, in this simple case, but it illustrates the point.

My second reason would be that it makes code more difficult to WRITE, I.E. it's not that hard to insert spaces when you mean to insert tabs, considering that you're not LITERALLY using only tabs just only tabs for indentation and alignment. And if you do accidentally have spaces mixed in, you're not going to be able to tell. The guy on another machine with different editor settings will, though.

I'm aware there are fonts that can make spaces and tabs visible and distinct, but that sounds like a NIGHTMARE to write and read code with. I mentioned above, my top priority is easy readability, and introducing more visual noise to make tabs and spaces distinct can only hurt readability.

[-] azimir@lemmy.ml 2 points 3 days ago

Because when I move left in tabs, the cursor isn't clear which tab I'm on. It also tried to sit off the left edge of a terminal in some editors because it aligns with the right side of the character (the tab), instead of the left.

I do see how tabs are a better option : they allow the one editing the file to decide how wide the indentation is. That's actually good User Interface design, by separating the data from the rendering layout.

I can see the argument both ways, but I like to use spaces so the visual and editing interfaces are more standard.

this post was submitted on 01 May 2025
133 points (98.5% liked)

Asklemmy

47852 readers
1655 users here now

A loosely moderated place to ask open-ended questions

Search asklemmy ๐Ÿ”

If your post meets the following criteria, it's welcome here!

  1. Open-ended question
  2. Not offensive: at this point, we do not have the bandwidth to moderate overtly political discussions. Assume best intent and be excellent to each other.
  3. Not regarding using or support for Lemmy: context, see the list of support communities and tools for finding communities below
  4. Not ad nauseam inducing: please make sure it is a question that would be new to most members
  5. An actual topic of discussion

Looking for support?

Looking for a community?

~Icon~ ~by~ ~@Double_A@discuss.tchncs.de~

founded 6 years ago
MODERATORS