Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Interesting. It's always been tabs as the winner at the places I've worked regardless of the language or platform.
-
Root797785ySpaces always win for me because of alignment. You cannot vertically align similar lines if you use tabs for indenting, because tabs are of indeterminate width. (I also hate needing to the change tab width in vim and terminals so it isn't freaking 8 wide.)
You can use tabs for indentation plus spaces for alignment, giving you the best of both worlds, but mixed whitespace is blasphemy. Git cli also complains about this.
So: spaces. -
Root is probably right on this one, spaces let you align stuff more creatively. But https://reddit.com/r/javascript/...
-
Spaces always works as intended, whereas tabs will require support from editors and IDEs. Moreover, if you, as I, work on different platforms using different editors (vi/vim, emacs, Eclipse) your work will be so much harder if there are tabs in our code instead of spaces. The only drawback with spaces is that the file size get a little higher, but I can live with that.
-
@stormwise Which editors don't support spaces? What kind of multi-platform problems do they cause?
-
@gronostaj All editors I know support spaces. They also support tabs but they are handled differently, which is the root of the problem. If you have written a file in emacs using tab setting of, say, 2 and then open the file using vi where default is 8, your work will be be more difficult. What is really annoying is spaces and tabs in the same file!
-
@stormwise Sorry, I meant tabs. That's kinda the point though, tabs win accessibility-wise. If you're using them only for indentation, not some fancy alignment, they work fine.
Related Rants
Spaces vs tabs has kind of become a non-argument for web tech and the former has won (at least in every place I've worked or observed in open source projects).
Although I don't really care (just stick to one for the same codebase) I don't get why spaces won. Given the argument is mostly about how we like to read code individually, and tab width can be configured per editor while space cannot, why did spaces win?
rant
tabs
wk190
spaces vs tabs
coding style
spaces