INN indentation
Richard Kettlewell
rjk at terraraq.uk
Sun Sep 19 10:26:43 UTC 2021
The current stated style is, in hacking.pod:
Use a roughly BSD indentation style but with four-space indents. This
means no space before the parenthesis around function arguments, open
brace on the same line as if/while/for, and close and open brace on
the same line as else.
However the reality is slightly more complicated: many files use tabs
and spaces interchangeably, apparently with an assumption that the tab
character represents 8 spaces, despite the coding style saying indent is
4 spaces.
However some editors that assume that the tab distance and the indent
depth always match, e.g. VS Code. It's a lot harder to figure out the
real layout of the code as a result.
Would it be possible to adopt an indent rule in which either tabs match
the indent depth, or tabs are not used at all, and reformat the source
code accordingly?
(My personal preference would be to completely ban the tab character
from source code, enforced with build time tests, since the meaning of
the tab character depends on local configuration and it is, empirically,
unrealistic to assume that everyone will share the same configuration.
But I don't mind what the solution is as long as it works. In the Go
world the policy is "indent = 1 tab" and that works in practice.)
ttfn/rjk
More information about the inn-workers
mailing list