3 ms·
Would be interesting to see a table of spaces per indent vs language or Project. I know the Linux kernel has an 8 spaces requirement. Code has been known to be
by yitchelle 7y ago
Would be interesting to see a table of spaces per indent vs language or Project.
I know the Linux kernel has an 8 spaces requirement. Code has been known to be rejected based on this violation.
- silon42 7y agoLinux kernel has 1 tab, which many/most would map to 8 (including me). Mapping to 8 has (and not 2 and 4) becomes relevant if you have line size limits.
- C1sc0cat 7y agoThat struck me as odd surely 8 is the norm - a holdover from typewriters
- dTal 7y agoI'm not sure that indentation should count towards line size limits at all, or at least not more than 1 character per indent. If it doesn't fit on your screen, you can change your tab width until it does.
- raverbashing 7y agoLinux kernel is 1 tab Golang also mandates tabs I think
- timclark 7y agoFrom memory go fmt will use both tabs and spaces when formatting but it uses tabs for indentation from the left margin and uses spaces for some alignment of variables - so it doesn't introduce any crazy interleaving of tabs and spaces which I like.
- majewsky 7y agoCorrect. And frankly, that's the logical choice. It allows to use different tabwidth for representation, while still aligning variables correctly with spaces. But this only works when you enforce an autoformatter, and way too few languages have a standardized autoformat.
- jordanrobinson 7y agoI remember seeing this a while ago: https://ukupat.github.io/tabs-or-spaces/ https://ukupat.github.io/tabs-or-spaces/ which is basically what you're talking about. Of note are Go and a few others, Go because it generally uses gofmt, which uses tabs, as far as I understand.
- pmontra 7y agoRuby standardized on 2 spaces per indentation level.