Earlier quoted context omitted.
There are some limits to what you can automate but stuff like spacing should definitely be enforced by a tool.
I feel like Prettier does a really good job with JavaScript. What situations have you found where automated formatting doesn’t suffice or has these limits?
Alternative code styles
101–107 of 107 posts
Re: Alternative code styles
#102Earlier quoted context omitted.
Interesting, yeah, that’s definitely missing. ESLint has rules for ordering, feels like it’d be a relatively simple addition to prettier.
eslint and prettier are not mutually exclusive
Re: Alternative code styles
#103This has to be satire. Most of these are terrible and I'm pretty sure the fibonacci indentation originated on /g/.
Re: Alternative code styles
#104Earlier quoted context omitted.
I'm 32 and I feel like I'm already at that stage sometimes. What will I be like when I'm 50?
I'm 70, push out production code every day (Horstmann style https://en.wikipedia.org/wiki/Indentation_style#Horstmann_st... ), and I'm having the time of my life.
EDIT: looks like the tool support is so bad, Horstmann himself pretty much gave up: http://horstmann.com/unblog/2010-06-28/braces.html
Re: Alternative code styles
#105Earlier quoted context omitted.
:O that is ... interesting. Sure that's not an entry for the ioccc? ;)
Nope :) This is being used everyday in production by most financial institutions. https://code.kx.com/wiki/Cookbook/InterfacingWithC I've been told that the guy who wrote this believe that the brain only has a limited buffer to compute source code. So he is trying to use the shortest code possible everywhere.
Re: Alternative code styles
#106Surprised nobody talks about the kdb codding style: https://github.com/KxSystems/kdb/blob/master/c/c/k.h
That's Whitney's style. My preferred example is http://www.kparc.com/b/b.c It looks obfuscated, but in fact it is just a lot of information. Many people would claim dividing it in 10 files with longer function names and less tricks would make it easier to understand, but after spending a long time studying (and partly rewriting) this code, I actually find the terse version better.
I also started using "result" after seeing it in Pascal code and have quite liked it for many years, but I just had the epiphany that "ans" (answer, as seen on several graphing calculator lines) would be a little more dense.
Basically, it was well worth it to try these radical styles out. They did a lot to smooth my everyday coding.
Re: Alternative code styles
#107Nowadays I couldn't care less about what style is used. As long as the code is consistent and there's an easy way to adhere (clang-format, black, prettier, etc.) I'm happy.
Put another way... if the proponent of a particular (serious) syntax style guide can't be bothered to automate it, then they are pissing in the wind. I laugh when I see those 50-page English-language documents describing how some institution wants code to be formatted. Ain't nobody got time for that.