by happyrock on 1/30/22, 3:38 AM with 21 comments
Are there other major variants of code formatting style still being developed out there?
[1] https://news.ycombinator.com/item?id=30130315
[2] https://github.com/boot-clj/boot/blob/master/boot/base/src/main/java/boot/App.java
by iamthad on 1/30/22, 5:00 AM
[1] https://en.wikipedia.org/wiki/Indentation_style#Horstmann_st... [2] https://bugs.llvm.org/show_bug.cgi?id=27263
by Rendello on 1/30/22, 6:09 AM
GNU C formatting is odd: https://en.wikipedia.org/wiki/GNU_coding_standards
Zlib still uses K&R-1st-edition-era function definitions: https://github.com/madler/zlib/blob/cacf7f1d4e3d44d871b605da...
by Someone on 1/30/22, 7:04 PM
I think that was done to make grepping for function definitions easier (when searching for the definition of foo, grep for “^foo\b”. That makes implementing “go to function definition” possible without having to parse code)
by mikewarot on 1/30/22, 4:49 AM
I myself am a huge fan of Pascal, and limiting code to one function per line. I find that clever/terse code is unmaintainable code.
Here's some code I wrote back in 1991 for a TECO clone that reflects that style. Looking back, I think some things could have a few more comments, but it seems fairly easy to read the intent of the code.
by twistedpair on 1/30/22, 4:02 AM
Given near all code (let's say for large projects) is authored with IDEs, elaborate formats can be applied consistently and automatically, at little or no cognitive or typing cost.
To me the question is then if such formatting can increase the legibility of the code. The grid of static variable declarations in [2] is nice, but I wonder if sorting the variable lexicographically would make it easier to read/find a var by name?
Not sure how splitting method signature names onto a second line helps, though.
by mtve on 1/30/22, 11:10 AM
Niklaus Wirth, Verilog: http://people.inf.ethz.ch/wirth/FPGA-relatedWork/RS232R.v
all of ioccc)
by muzani on 1/30/22, 10:27 AM
Example:
<!-- Recommended -->
<!DOCTYPE html>
<title>Saving money, saving bytes</title>
<p>Qed.
https://google.github.io/styleguide/htmlcssguide.html#HTML_F...by drpixie on 1/30/22, 7:31 AM
Sound confusing - very. I could see his "logic" but as to teaching programming students ... yes confusion all round, and wait till the poor students move on to any other language #@%%!$#!!!
by a9h74j on 1/30/22, 4:42 AM
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.
by idiocrat on 1/30/22, 4:02 AM
by vanusa on 1/30/22, 11:14 PM
To make it "less crowded", and allow space for future comments, I was told.