Tabs or Spaces?

General discussion about LÖVE, Lua, game development, puns, and unicorns.

Tabs or Spaces?

Tabs
25
76%
Spaces
6
18%
Mix
2
6%
 
Total votes: 33

User avatar
Kingdaro
Party member
Posts: 395
Joined: Sun Jul 18, 2010 3:08 am

Tabs or Spaces?

Post by Kingdaro »

I'm curious, and maybe we can get sort of a discussion going here. Which is your preference, and why? If you use tabs, what is your tab width? If you use spaces, how many? If you use a mix of the two, how so?
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Re: Tabs or Spaces?

Post by Zilarrezko »

I tab with a 2 wide space.

I use tabs because If I mixed them, It would look wonky if someone else had a different tab width. Like on my laptop when I code at school, where my tab width is 3 oddly enough. (It's that compressed 1080p screen I'm sure.)
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Tabs or Spaces?

Post by Davidobot »

I use Sublime with just tabs, which will equal to 4 spaces. (I have a big monitor)
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Tabs or Spaces?

Post by kikito »

Spaces only. Two per level. My tab key produces spaces, and I have a editor command which replaces tabs with spaces.
When I write def I mean function.
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Tabs or Spaces?

Post by zorg »

Until my code is ready to be released, tabs, since i use the same editor always, so it will always look the same, and before releasing, i convert them to 4 spaces.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Tabs or Spaces?

Post by kikito »

Here's what some "big guys" are doing regarding spacing:

Spaces:
  • The Lua-users page recommends 2 spaces, no tabs
  • The OlivineLabs guys use 2 spaces, no tabs
  • In Programming in Lua, all the examples use 2 spaces, no tabs (example).
  • The examples in the Lua Reference Manual also use 2 spaces, no tabs (example).
  • The examples in Beginning Lua Programming all use 2 spaces, no tabs. I could not find an online abstract to link examples.
Tabs:
When I write def I mean function.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Tabs or Spaces?

Post by bartbes »

kikito wrote: Spaces:
  • The Lua-users page recommends 2 spaces, no tabs
  • The OlivineLabs guys use 2 spaces, no tabs
  • In Programming in Lua, all the examples use 2 spaces, no tabs (example).
  • The examples in the Lua Reference Manual also use 2 spaces, no tabs (example).
  • The examples in Beginning Lua Programming all use 2 spaces, no tabs. I could not find an online abstract to link examples.
I'm a tab guy myself, but don't take this as me claiming my superior choice. These are all examples (except the OlivineLabs one, maybe) of displaying code in (virtual) print. In my mind is only obvious that spaces are used in print, because often you care about how the website looks. Also note that html, for instance, is more suited to printing spaces than tabs.

That said, this discussion is completely pointless, there are no benefits either way. Use what you like best, or what the project you're working on uses (so start projects, you get to decide!). I think the worst outcome of discussions like these is programming languages forcing the usage of one over the other.

As an extra illustration, the LÖVE codebase uses tabs for indentation and spaces for alignment, and if it were any other way, it would still be LÖVE.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Tabs or Spaces?

Post by Jasoco »

Tabs. Tabs tabs tabs.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Tabs or Spaces?

Post by Positive07 »

I use tabs and let github resolve the width by himself (it lets you chose between 2, 4, 6... spaces)
If I download a library/code/snippet or something I just use Notepad++, take a copy of the number of spaces used to indent, and replace it with a tab... it's really easy so I have no problem

I use tab because:
  • Its just one keypress
  • I can delete it with a single keypress
  • Allows me to select lots of text and press tab once to indent it all (or shift tab to un-indent it)
Again, this is what I like and what I'm used to, not the final answer
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Tabs or Spaces?

Post by ivan »

It's 2 spaces for me. Notepad++ has a setting that overwrites tabs with spaces automatically.
Another reason to use spaces is that tabs may be displayed differently by different editors.
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests