4 ms·
Parenthesis are one of the most elegant things about Lisp, and I would hate to have to live without them. When I finally got around to learning Python, I found
by pmoriarty 8y ago
Parenthesis are one of the most elegant things about Lisp, and I would hate to have to live without them.
When I finally got around to learning Python, I found that its meaningful whitespace usually wasn't as bad as I'd feared, but it's still a pain in the ass in certain circumstances.
For instance, there are plenty of places online (like some blogs) where python code is published that screws up its whitespace so that copying and pasting from there totally screws up the program and I'm forced to fix it by hand. This is an unnecessary pain that explicit delimiters like Lisp's parenthesis solve.
Python's meaningful whitespace is also not enough for editing software to easily infer and manipulate the program's structure without actually knowing python. That's a burden that editors that are editing Lisp do not have, as they're always just going to be manipulating sexps, without needing a deep understanding of the underlying language. So that usually makes sexp-aware editors (and plugins like pariner) much more powerful and flexible when editing Lisp than your typical python editor.
Python also has way too many other types of delimiters. Though modern Lisps also don't have just parenthesis, most of their delimiters are parenthesis and that makes thinking about which delimiter is appropriate in which context a lot simpler. You have a lot less rules to remember, and that's a blessing if you're a polylingual programmer who's bouncing around from one language to another -- you mostly don't have to remember which delimiter has to go where, as it's mostly just a parenthesis with Lisp.
Instead of trying to improve Lisp by taking away parenthesis and adding meaningful whitespace, I'd rather improve Python by taking away its meaningful whitespace and using parenthesis.
- nojvek 8y agoHa! I love how I’m being downvoted for thinking different. I love indented languages. Python, make, coffeescript etc indentation communicates hierarchy. It’s a very simple idea. All I’m saying is Lisp is amazing but parens aren’t for everyone. Lisp is essentially list of lists. There are other ways of representing that
- chriswarbo 8y ago> I love indented languages. Python, make, coffeescript etc indentation communicates hierarchy. It’s a very simple idea. > All I’m saying is Lisp is amazing but parens aren’t for everyone. It's trivial to write Lisp using indentation and no parentheses if you want to. The same goes for any language which uses s-expressions. Just pick an alternative syntax, e.g. - Readable http://readable.sourceforge.net http://readable.sourceforge.net - Sweet expressions https://www.dwheeler.com/readable/sweet-expressions.html https://www.dwheeler.com/readable/sweet-expressions.html https://srfi.schemers.org/srfi-110/srfi-110.html https://srfi.schemers.org/srfi-110/srfi-110.html - I-expressions https://srfi.schemers.org/srfi-49/srfi-49.html https://srfi.schemers.org/srfi-49/srfi-49.html - Wisp https://srfi.schemers.org/srfi-119/srfi-119.html https://srfi.schemers.org/srfi-119/srfi-119.html http://www.draketo.de/english/wisp http://www.draketo.de/english/wisp These can all be converted back and forth to s-expressions, such that the programmer doesn't have to care about s-expressions (found some code online? send it through a converter before reading it), and the language implementation doesn't have to care about the syntax that the programmer is using (set up the relevant converter as a preprocessor). Two things to note: - The reason we can do this is because s-expressions are such a useful language format. Using an alternative syntax for Python, make or coffeescript would be a time consuming, maintainence heavy burden. Anything using s-expressions gets all this "for free". - The fraction of Lisp programmers who do this is vanishingly small. This is empirical evidence that parentheses are not a problem worth caring about.
- nojvek 8y agoOh wow. I-expressions. Didn’t know that was a thing. So clean and simple! I’m sold.