There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

aidan ,

I will never understand why people are so set on spaces…

darknavi ,
@darknavi@vlemmy.net avatar

Tabs are blasphemy.

aidan ,

Why?

1rre ,

I use spaces, but tabs use fewer characters, are easier to edit and allow for people to have custom indentation levels…

BrerChicken ,

I will never understand why people are so set on spaces…

They just never really understood tabs. If they did, they wouldn’t be sitting there counting how many times they hit the space bar!

einsteinx2 ,
@einsteinx2@programming.dev avatar

We understand tabs perfectly, we press the tab bar and our editor inserts 4 spaces like god intended

lightsecond , (edited )

If you’re using monospaced fonts for writing code (please tell me you are) spaces make sure that the code will look roughly the same on everyone’s machine.

<pre style="background-color:#ffffff;">
<span style="color:#323232;">def function(paramX: str,
</span><span style="color:#323232;">             paramY: str,
</span><span style="color:#323232;">             paramZ: str) -> int:
</span><span style="color:#323232;">  pass
</span>

If I’d used tabs, the second and third parameter might not align with the first.

Also, left-side indentation is only a small part of the overall whitespace in code. You’re adding whitespace even when you write x = y. Spaces make sure that this whitespace around the = grows in the same scale as the indentation.

aidan ,

Yes but it’s not your job to make sure your code looks the same for everyone else. If they’d prefer to read it with a different tab size, maybe they’re using a smaller screen, or a larger one because of vision issues there’s no reason they shouldn’t. You can use an optional editor config if you want it to be able to look the same for others.

lightsecond ,

It makes a difference when you’re working on a large project with lots of people. Even Linux mandates 1 tab = 8 spaces.

The only argument i see in favour of tabs is the “i can change the width on my own machine!” which isn’t very convincing if you are working on a team and need to follow conventions every time you commit code. The indentation will keep looking weird on your machine.

aidan ,

Yes so you can choose to follow that convention, but it being adjustable for reading is very useful for reading on different screensizes or with eyesight issues. Why not just set what you want in an editor config?

lightsecond ,

Well, life is about trade-offs and neither spaces or tabs are perfect in every scenario, but the industry overall prefers spaces over tabs nowadays and the tooling reflects that too. For me personally, as long as a project is consistent in its formatting and developers don’t need to fight its tooling, I’m happy with either. We can yak shave all we want (and lots of people are doing that on the internets) but I hope I at least answered your initial question about why people prefer spaces over tabs.

aidan ,

That’s fair, you did thank you!

Klear ,

That joke in the second panel though…

ChinaNumberOne ,

https://149351115.v2.pressablecdn.com/wp-content/uploads/2017/06/tabs-spaces-featured.png

using spaces: google, microsoft, apple

using tabs: linux, gnu

MarcellusDrum OP ,

Why is this a line graph? What’s on the X axis?

kakes ,

Casualties.

ksynwa ,
@ksynwa@lemmy.ml avatar

Who tf uses both?

lightsecond ,

Google employees who work on the Linux kernel.

kakes ,

Just a heads up: You and I have fallen for the classic blunder on replying to a 1-year-old thread.

lightsecond ,

Classic lemmy

pinknoise ,
@pinknoise@lemmy.ml avatar

Unrealistic, everyone knows that tabs are 8 characters

XTornado ,

Nah, 2.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • [email protected]
  • lifeLocal
  • goranko
  • All magazines