News for hackers. Stuff that matters.
Re:Ask HN: Examples of Unusual Code Formatting Styles? by iamthad on Sunday January 30, 2022 @12:00AM (#30134186)
I find the Horstmann indentation style [1], in which code is placed on the same line as the opening bracket, simultaneously disturbing and compelling. If it ever ends up added to clang-format as has been requested [2], it might become more popular.

[1] https://en.wikipedia.org/wiki/Indentation_style#Horstmann_st... [2] https://bugs.llvm.org/show_bug.cgi?id=27263

Re:Ask HN: Examples of Unusual Code Formatting Styles? by adamhp on Sunday January 30, 2022 @08:11AM (#30136871)
It is fascinating that we've developed a sense of aesthetics around this, though I suppose it is to be expected with how much we are oriented around language.

I personally use 1TBS wherever possible. It just looks the cleanest to me.

Re:Ask HN: Examples of Unusual Code Formatting Styles? by pkulak on Sunday January 30, 2022 @01:34AM (#30134651)
Oh my God, I think I like it.
Re:Ask HN: Examples of Unusual Code Formatting Styles? by muzani on Sunday January 30, 2022 @05:24AM (#30135608)
This is actually very sensible. I don't like the top bracket being its own line, but there's good reason for it to align with the bottom bracket.
Re:Ask HN: Examples of Unusual Code Formatting Styles? by videogreg93 on Sunday January 30, 2022 @07:32AM (#30136596)
Java style formatting removes the "bracket on its own line" problem, so I'm not sure how this new indentation style adds anything of value really.
Re:Ask HN: Examples of Unusual Code Formatting Styles? by mikewarot on Sunday January 30, 2022 @03:03AM (#30135010)
I like it too. It makes C code actually look readable. It would be interesting to see it applied to Lisp code.