Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Oh oh lets fight ;-) 2 Spaces, 4 Spaces, 1 Tab (view as 2 Spaces or 4 Spaces).

Important is to configure once your favorite Editor and use it consequent.



As someone who prefers tabs, but doesn't care enough so will happily use spaces, I've never understood the hatred around tabs.

Not only does it remove the 2 vs 4 spaces debate (just set your browser preferences to display it as whatever!), it's more 'semantically correct' - it's literally saying "one level of indentation please".

Anyway, not that I particularly care - I just always found it amusing that this is where developers have chosen against things being semantically correct and user-configurable.


I used to prefer tabs (for the exact reason, tabs indicate an indent, spaces indicate a space) except for one edge case that has me using spaces now. If you're anal about making sure chained method calls line up on their own lines, spaces guarantee that across the board, but tabs would mess up the indent.

  var foo = SomeTerriblyLongHorrificClass->withUnreasonablyLargeChildren()
                                         ->dueToTheOddNumberOfCharachters()
                                         ->sometimesItsNiceToUseSpaces()
                                         ->here()


If you were really committed, you would have renamed your names to force them to line up with tabs :)


i like this guy




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: