3 ms·
"parens ... make them optional ... and I would argue (again at my peril) that if it was optional in a lisp-style language as well, that would be great." ^ mak
by nocman 9y ago
"parens ... make them optional ... and I would argue (again at my peril) that if it was optional in a lisp-style language as well, that would be great."
^ making parens optional in a lisp would IMHO make everything more complicated at best.
Someone else in this thread mentioned SRFI 49. Personally I don't find it's syntax...
define
fac x
if
= x 0
1
* x
fac
- x 1
... to be any easier to read or understand than the usual scheme syntax:
(define (fac x)
(if (= x 0)
1
(* x
(fac (- x 1)))))
In fact I much prefer the latter. I see absolutely no advantage to making the parens optional, and I see lots of disadvantages to removing them. Especially when it comes to implementing something like lisp macros, I think removing parens would greatly complicate that and open the door for tons of ambiguity, as well as making it far too easy to misinterpret what the code was doing.
I agree with sedachv. Your "mistake" is not that you are criticizing lisp. It's just that those of us here that know lisp don't see your criticism as being valid, and we do not see your suggestions as being something that would make lisp better, but on the contrary would make it much worse.
- AdeptusAquinas 9y agoSRFI 49 went too far the other way. In F# the expression would be: let rec fac x = if x = 0 then 1 x * fac (x - 1) Or with pattern matching: let rec fac = match x with | 0 -> 1 | _ -> x * fac (x - 1)
- nocman 9y agoI suspect that SRFI 49 went as far as it did in an attempt to reduce ambiguity (but I haven't spent much time looking at it, so take that with a grain of salt). I understand why people prefer the combination of infix expressions and a possible reduction in the number of bracket-like symbols in their programming language (indeed, as I stated before, I originally found lisp syntax to be weird, and originally I didn't like it). When things are different than what you are used to, it is common to not like them. However, having spent a considerable amount of time programming in lisp-like languages, I find that the benefits of prefix notation and the use of parens as boundaries in the language far outweigh the costs of having them there. Any discomfort with the aesthetics of the code seems to fade with time for most people (if they are willing to spend enough time using the language to get used to them).