3 ms·
I've always wonder why no C or Java code formatter tool allows me to use Lisp-style formatting. It's clearly superior, and the popularity of Python should prove
by lokedhs 9y ago
I've always wonder why no C or Java code formatter tool allows me to use Lisp-style formatting. It's clearly superior, and the popularity of Python should prove that people are OK with not having closing braces on their own lines:
void foo(int x) {
if(x == 0) {
bar() }}
- jrimbault 9y agoAfter having seen a meme, I gave a teacher a project formatted like this: public class Main { public static void main(String[] args) { System.out.println("Hello world!") ;}} We had a good laugh. (that was fine with him, of course as long as it's a joke) PS: getting back to the original topic, imo, formatting style should be project-wide rules set at the beginning or during refactoring. Don't get too hung up on style as long as it stays consistent.
- kazinator 9y agoI've written a bit of code formatted rather like this: void foo(int x) { if(x == 0) { bar(); } } That is workable. I have adhered to it (mostly) in this Yacc grammar file: http://www.kylheku.com/cgit/txr/tree/parser.y http://www.kylheku.com/cgit/txr/tree/parser.y Just in the grammar; not in the supporting functions. It's an attractive style for C statements embedded in another language, because they look more like capsules somehow.