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

Some programmers prefer 2 spaces, some programmers prefer 4, why don't we compromise and pick a number between 2 and 4?
 help



hence tabs. just configure your display for the width you like.

though I do wish more editors had some kind of "ignore the spacing, display it semantically like [this]" and just let you insert whatever you wanted, converted to whatever is nearby, and didn't touch lines you didn't create. there's no reason to even have the debate or care about inconsistencies, you can essentially always* convert between them losslessly in terms of behavior.


Given a choice between (spaces) and (mix of tabs and spaces) -- these being the only two options IRL -- it's not hard to see why spaces won.

The next iteration is "smart tabs", where indents are stored as spaces in files for consistency, but when using an editor it recognizes that something special is going on, and offers you a tab-like experience.

which they kinda already do, yea. I just want it to be stronger, and to correct indentation that doesn't follow your formatting rules (which I have not seen / is not widespread). kinda like a `gofmt` overlay on a file, rather than modifying the file directly.

as a bonus, this could also make `goto fail;` errors more obvious.


The compromise is to defer to a standard formatting tool such as prettier or pip8.




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

Search: