4 ms·
There have been at least three attempts to change the syntax of Lisp, so that it looks more like Algol: Lisp 2, CGOL, and Dylan. None of these gained much tra
by DonaldFisk 9y ago
There have been at least three attempts to change the syntax of Lisp, so that it looks more like Algol: Lisp 2, CGOL, and Dylan. None of these gained much traction. Lisp programmers prefer the parentheses.
When you autoindent, the indentation of the code makes its underlying structure (AST) clear without having to count either parentheses in Lisp or braces in C. By the 1970s, autoindenting editors (EMACS) and structure editors had been developed for Lisp. In the C/Unix world, until recently, indentation and parenthesis/brace counting had to be done by hand. Among C programmers (but not, to their credit, Java programmers) there are still arguments about code layout, a problem solved decades ago for Lisp.
- kazinator 9y ago> In the C/Unix world, until recently, indentation and parenthesis/brace counting had to be done by hand. Nope! The vi editor has a :set lisp mode, and a % command to jump to matching parens. I think that was already in vi in the 1980's. FWIW, % is described in POSIX; Lisp mode isn't.
- DonaldFisk 9y agoTa. I just tried it. If it's all the same with you I think I'll stick with Emacs. :-) What I was trying to say is that these things are easier to do by hand in C than in Lisp, but more difficult to do algorithmically, and this discouraged people developing syntax-aware editors, and encouraged the plethora of competing C styles. In the Lisp world, the difficulty of doing these by hand resulted in earlier syntax aware editors and the consensus on style.
- kazinator 9y agoIn Lisp style, there is a "local maximum" (global?). Deviations from the style are obvious losers. In C, there are many choices, which are all viable. int main(void) { FILE *f = fopen("commands", "r"); if (f) { char line[512]; while (fgets(line, sizeof line, f)) { ... } fclose(f); return 0; } else { printf("failed to open file\n"); exit(EXIT_FAILURE); } }
- DonaldFisk 9y agoThe many choices available for C are the problem. I write C in K&R style, but that makes me a heretic in many places. Java programmers have sensibly agreed on a single style, despite there being as many choices for Java as there are for C.