Tabs or Spaces?
Tabs or Spaces?
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?
- Zilarrezko
- Party member
- Posts: 345
- Joined: Mon Dec 10, 2012 5:50 am
- Location: Oregon
Re: Tabs or Spaces?
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.)
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.)
Re: Tabs or Spaces?
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
personal page and a raycaster
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Tabs or Spaces?
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.
- zorg
- Party member
- Posts: 3470
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Tabs or Spaces?
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 True 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.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Tabs or Spaces?
Here's what some "big guys" are doing regarding spacing:
Spaces:
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.
- Wikipedia recently switched from 4 spaces (no tabs) to tabs (no spaces), because their default editor changed.
When I write def I mean function.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Tabs or Spaces?
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.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.
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.
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Tabs or Spaces?
Tabs. Tabs tabs tabs.
- Positive07
- Party member
- Posts: 1014
- Joined: Sun Aug 12, 2012 4:34 pm
- Location: Argentina
Re: Tabs or Spaces?
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:
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)
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Re: Tabs or Spaces?
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.
Another reason to use spaces is that tabs may be displayed differently by different editors.
Who is online
Users browsing this forum: pgimeno and 2 guests