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
Ask HN: Examples of Unusual Code Formatting Styles?
11–20 of 22 posts
Re: Ask HN: Examples of Unusual Code Formatting Styles?
#12I 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?
#13Example:
Saving money, saving bytes
Qed.
https://google.github.io/styleguide/htmlcssguide.html#HTML_F...Re: Ask HN: Examples of Unusual Code Formatting Styles?
#14I've seen this in the wild and have been meaning to ask: With the availabily of syntax highlighting including color, has anyone seen merit in skipping indentation altogether? For that matter, what if block color or font size took the place of indentation (under control of syntax highlighting). I'll have to try it by hand.
However, we have more async stuff than ever before. Heavy nesting is frequent.
And then you have the weird new imperative UI stuff like Flutter/Jetpack Compose where a simple layout is brackets in brackets in brackets in brackets.
Rainbow brackets are a thing though - one of the most popular plugins in many IDEs is something that highlights different colour brackets.
Re: Ask HN: Examples of Unusual Code Formatting Styles?
#15Niklaus Wirth, Verilog: http://people.inf.ethz.ch/wirth/FPGA-relatedWork/RS232R.v
all of ioccc)
Re: Ask HN: Examples of Unusual Code Formatting Styles?
#16I 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
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?
#17I 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
I personally use 1TBS wherever possible. It just looks the cleanest to me.
Re: Ask HN: Examples of Unusual Code Formatting Styles?
#18I like Google's HTML style where they don't close some tags and omit optional tags like and Example: Saving money, saving bytes Qed. https://google.github.io/styleguide/htmlcssguide.html#HTML_F...
Re: Ask HN: Examples of Unusual Code Formatting Styles?
#19I like Google's HTML style where they don't close some tags and omit optional tags like and Example: Saving money, saving bytes Qed. https://google.github.io/styleguide/htmlcssguide.html#HTML_F...
Disgusting. I bet the person who came up with it doesn't close their parentheses.
Re: Ask HN: Examples of Unusual Code Formatting Styles?
#20If you need some ideas for brainstorming, here is the endless source for inspiration. https://shitcode.net/