in reply to Re^2: How has your coding style changed over the years?
in thread How has your coding style changed over the years?
I use 1TBS which is close to (or perhaps even what you were meaning by) K&R. It (opinion!) makes maximum use of space without sacrificing clarity and in my mind the end of a block statement being at the same indentation as the start of that statement makes perfect sense.
Elsewhere (mostly C++) I indent curlies to the same level as the rest of the block they are part of.
If you were to do the same in Perl would you write like this?
sub foo { my @args = @_; unless (scalar @args) { warn "No args in foo!"; return; } return join ':', @args; }
That is (or looks like) full Whitesmiths which I have seen on occasion in some Perl code but it just messes with my head. It also seems to go against this comment in perlstyle:
Regarding aesthetics of code lay out, about the only thing Larry cares strongly about is that the closing curly bracket of a multi-line BLOCK should line up with the keyword that started the construct. Beyond that, he has other preferences that aren't so strong ...
I am happy to adhere to Larry's wishes on this one.
🦛
|
---|