3 ms·
For Lisp, parentheses are a big plus. They allow the following advantages: TL;DR: Once you start programming in Lisp for long enough, you end up loving and emb
by flavio81 9y ago
For Lisp, parentheses are a big plus. They allow the following advantages:
TL;DR: Once you start programming in Lisp for long enough, you end up loving and embracing the parentheses.
0. They allow for an extremely simple syntax, which in turn allows the source code to easily manipulate source code. No simple syntax, no really easy way to write macros. And macros are one of the most essential keys to Lisp's power.
You can argue that, without extremely simple syntax, a Lisp language is not possible.
1. Syntax, being so simple, is extremely easy to learn. Yesterday i explained Lisp's syntax to a friend, in 3 minutes.
2. No need to care for special operator precedence rules. The precedence of operators is obvious by looking at the code.
3. IDEs, like SLIME, can easily traverse the code in many powerful ways. Due to this syntax, the IDEs can "understand" expressions and expressions within expressions. This means that the IDE can 'understand' any part of your code, not just big constructs like functions, methods or classes.
4. IDEs will also easily complete the parentheses for you, and will warn you of a missing parenthesis.
5. It is also dead simple to understand which parenthesis closes which one. It can be done with most source code editors -- Even a simple program like Notepad++ can do it, Visual Studio Code can do it, etc.
6. Parentheses also enable IDEs to automatically apply "pretty" format to the code rather easily.
7. As anything, you get used to it. Many people, for example, think that, in Python, whitespace as a block delimiter is a bad idea, however I never had any problem with that, it was just fine. Unless you are using Windows Notepad to edit code...
- graphememes 9y agoThis is more an emotional response to me than it is functional or logical one since you can apply all of these points to any other language.
- iLemming 9y agoIt's not emotional, no. After just a few months of using Lisps it feels like parentheses bring some structure and order. In non-lispy languages things feel "all over the places" - there you do have to deal with punctuation - not just parens but: semicolons, dots, commas, brackets, curlies, indentation. Programming in a Lisp is like writing a prose. Your brain is occupied with ideas, you just need to type them down. You don't need to think about structure (until later), it's a flow - you're looking for right words (functions), you can immediately try them out in the REPL, pretty much like a writer would review usage of a word in a thesaurus or a dictionary. But to be fair I met a few people who claimed that even after months of using a Lisp, they just couldn't get the parentheses. I dunno, guess some people's brains maybe just not suited. You can call it dyslisplexia or whatever.