10 ms·
"Why on Earth would anyone want to use a language with such horrific syntax?!" What is it with statements like this? It just sounds like a 'meme' to me, that
by kruhft 9y ago
"Why on Earth would anyone want to use a language with such horrific syntax?!"
What is it with statements like this? It just sounds like a 'meme' to me, that everyone hears (even from advocates like this one) at first that the 'syntax' (of which there is a lot less than most languages in a Lisp) is 'horrible'?
Of course, we, the learn-ed of Lisp, say that after a while the 'parens just disappear', which they don't, but they sure help (when combined with Paredit) in defining code like structures that can be manipulated with ease in your editor.
I know the author is just trying to do a bit of a 'sandwich' with the article, but please, advocates and enemies of Lisp, just give up on picking on the parens. It's stupid and been done a million times. It's like 'why do we have to type so much to enter programs! such a pain!'.
Boring.
- VyseofArcadia 9y agoThat said, it would be nice if lisp used square brackets for this instead. Easier to type on boring old US QWERTY.
- Zelphyr 9y agoRebol and Red are very Lisp like and use square brackets instead of paren's.
- thedirt0115 9y agoNo problem, just a couple reader macros! (Adapted from an answer on https://stackoverflow.com/questions/1988/how-far-can-lisp-macros-go https://stackoverflow.com/questions/1988/how-far-can-lisp-ma...) ;; Make [] == () (set-syntax-from-char #\[ #\( ) (defun lbrace-reader (stream inchar) (declare (ignore inchar)) (read-delimited-list #\] stream t)) (set-macro-character #\[ #'lbrace-reader) (set-macro-character #\] (get-macro-character #\) )) (set-syntax-from-char #\] #\) )
- mikegerwitz 9y agoSome lisps use parenthesis and brackets interchangeably. Some people prefer to strategically alternate them, but you're free to use them exclusively. Guile Scheme, for example: scheme@(guile-user)> [list 1 2 3] $1 = (1 2 3) scheme@(guile-user)> (list 1 2 3) $2 = (1 2 3) scheme@(guile-user)> [car '[1 2 3]] $3 = 1
- eatonphil 9y agoWhile true, this is not officially supported as part of the RnRS standard I believe. They set these characters aside as reserved for future use.
- mikegerwitz 9y agoYes, you're correct. R7RS at least explicitly reserves brackets and braces, and only acknowledges parenthesis in its syntax.
- lispm 9y agoI think this depends on which RnRS you look at.
- ketralnis 9y agoRacket can use either. They are syntactically equivalent, but there are some community norms around when to use each. Racket’s included editor DrRacket takes the [ and ] keys and figures out which to use using those conventions, inserting either [ or ( as appropriate
- krapp 9y agoI'd like to see square brackets replace the backtick. I only have a cursory familiarity with lisps but I constantly find that too easy to miss.
- kuschku 9y agoSquare brackets are AltGr-8 and AltGr-9 on German T2, but Parens are Shift-8 and Shift-9, which is much nicer on the hands. So I’m going to be against this.
- sedachv 9y agoParentheses are so much more frequently typed than square brackets in almost every context that you are better off following the Lisp Machine keyboard layout and swapping them on your keyboard even if you do not program in Lisp: https://news.ycombinator.com/item?id=14985932 https://news.ycombinator.com/item?id=14985932
- ScottBurson 9y agoYes, agreed. From your previous comment: > Apple does not provide a way to do these remappings on OS X Run Emacs (or XEmacs) under XQuartz and you can do whatever remapping you want. This is how I deal with it. Another choice is a fully programmable keyboard, though these also tend to have nonstandard layouts that require some retraining.
- chuchana 9y agoThere is no need for X, you can just use elisp, i.e.: (keyboard-translate ?\[ ?\() And unless you do need X, I suggest using Emacs-Mac-Port instead of of the official Emacs: https://bitbucket.org/mituharu/emacs-mac/overview https://bitbucket.org/mituharu/emacs-mac/overview
- phoe-krk 9y ago$ setxkbmap -option parens:swap_brackets
- dmitriid 9y agoA language’s syntax is the very first thing you encounter. And if you are not familiar with it, it will be a major sore point when trying to learn the language. So yes, while complaints about syntax are largely irrelevant once you already know the language, the complaints will be there for any new user.
- ajkjk 9y agoI don't really mind the parens, but the whole attitude feels indicative of a problem. Like - it's 2018 and people are still using 'cdr' and 'cons' as terminology and happily expecting other people to learn those words and not even feeling bad about it. If the person justifying Lisp doesn't mind that the word 'cons' is terrible, why should I trust their aesthetic sense about anything? If I have to have "miserable notations" to get "coding nirvana", and coding nirvana is so great, why not fix the notations? do you just think everyone should have to struggle because you did? I guess it feels like trying to determine which of these statements are true: (1) "Lisp is coding nirvana" (2) "Lisp is weird regressive nostalgia for a simpler era where nothing was typed and everyone used Emacs and memorized arcane terminology and shared macros on Usenet", and there are way too many signs that it's a lot of (2). [edited to be less abrasive]
- bluefox 9y agoI read: whyknow thing like word"and"sentence to write and plural and capitalization comma dot semicolon space question mark need write spaces between them wordamabobs why don't fix notation???
- ajkjk 9y agoI don't see your point. Do you disagree that things can be named badly?
- bluefox 9y agoPoint is: Lispers obviously don't care about what you care about. That is why they don't fix it: it's not broken for them.
- ajkjk 9y agoIf someone evangelizes something and doesn't see and doesn't apologize for obvious flaws ("I promise this is worth it even though it's obviously flawed!), that makes me seriously doubt their reasons for preferring it or their ability to empathize with other people. At risk of being offensive: yes, it's clear that Lispers don't care, but that makes me think they're masochistic or autistic, not that I should use their favorite language.
- BeetleB 9y agoI can handle parentheses. What really gets me? Semicolons. Most useless character in programming language history. Every time I switch from a language that doesn't require them to one that does, the pirates run away from me.
- outworlder 9y agoThis. At least parentheses have a useful purpose and can even help you when writing code (paredit and the like). Semicolons are only there to help compiler writers. It would be ok if they were allowed, but optional. How many times do you really have to write more than one statement per line?
- cptn_brittish 9y agoThe issue is these days everytime I hear optional I think of semicolons in JavaScript where they are optional except for one or two edge cases I can't remember off the top of my head. Optional is good as long as its a complete you can do it this way or that way like gradual typing in some languages.
- outworlder 9y agoIndeed. I meant really optional, not something like automatic semicolon insertion, where they are there, they are required by the grammar, but you are allowed to omit them in some cases.
- etiam 9y ago> the pirates run away from me Nice expression. Is it a pop culture reference I have missed?
- AnimalMuppet 9y agoI suspect (but do not know) that the reference is "swearing like a pirate". BeetleB is (I think) saying that semicolons lead to swearing that even the pirates are offended/appalled. (It took me reading it a few times to get that, and I'm still not certain it's right.)
- macromaniac 9y agoIt is a true statement, lisp syntax is wierd. You spend years learning that 2 + 2 = 4, seeing (+ 2 2) for the first time is a bit of a shock. The point is overused but its a good point and he doesnt dwell on it. Arguments shouldnt be evaluated just by how interesting they are.
- zsck 9y agoThe parent post shouldn't be interpreted as dismissing the argument because it isn't interesting but because it has been beaten to death. It's the kind of argument that has been had from every meaningful angle and the programming community has, unless I'm wildly mistaken, settled on a few conclusions regarding it. Like a lot of things, one conclusion is simply that Lisp syntax being good, bad, easy or difficult to read comes down in part to preference of the individual. Of course there are other conclusions as well, but the point is that dwelling on the subject is generally not a productive use of time. It's so old and popular to discuss that very little of value comes from discussing it further, and repeating the arguments is both distracting and potentially even discouraging for some less experienced programmers.
- msla 9y agoAlgol syntax is weird. Tell me, what does this mean? x = x + 5 Obviously, it's a null statement. It's nonsense. x cannot equal x + 5 because that means 0 = 5 and, therefore, 0 = 1 and, therefore, all mathematics is broken. However, most Algols are completely happy to accept that statement, something we learned was nonsensical way back in our childhoods, as not only valid but as the only way of doing things. My point is, there is no such thing as a natural syntax. They're all weird. They all have to be learned. Some provide more benefits than others after they've been learned. (Also: You're only a newbie once. Optimizing for that one-time thing is a bit odd, when you'll spend far more of your life as an experienced programmer.)
- ScottBurson 9y agoThat's precisely why Algol used ':=' for assignment ;-}
- dwc 9y ago> but please, advocates and enemies of Lisp, just give up on picking on the parens Each non-lisper will reinvent the argument from scratch, so advocates can't profitably ignore it. It's a shame. You get past that so quickly after using lisp.