3 ms·
Criticising lisp was a mistake, and I should have already ripcorded my way out of this discussion thread already, but you make some good points, so I'll respond
by AdeptusAquinas 9y ago
Criticising lisp was a mistake, and I should have already ripcorded my way out of this discussion thread already, but you make some good points, so I'll respond at my own peril:
I didn't suggest you implied that lisp isn't written without indentation. Yes I have coded with lisp, and I know they use other syntax than just parens.
Parens serve an important purpose with lisps, just like the semi colon does in c languages. As a C# programmer I can, and have, written long statements on one line; in particular, LINQ statements lend itself to this if you use the method syntax, which I use exclusively over its query syntax form. To make it readable you break it over lines but terminate with a semi colon to finish: it is still run as a single statement. This is powerful.
In F# you can still do this, but it requires that the entire statement start at the appropriate indentation in order for the compiler to infer the closure.
Indentation can cause misinterpretations, but I'd argue, at least for me, that the happy case (i.e. 99% of a given codebase) that using indentation instead of parens, curly braces or similar, is a less clutter free way of writing code. And, since its something that is generally done anyway, it makes curly braces/parens redundant. Note that in F# you can use parens as well to group code, if you need to enforce a closure, which is a good design decision: make them optional. C# would be much better, and I would argue (again at my peril) that if it was optional in a lisp-style language as well, that would be great.
- sedachv 9y ago> Yes I have coded with lisp, and I know they use other syntax than just parens... I would argue (again at my peril) that if it was optional in a lisp-style language as well, that would be great. The reason you are getting downvoted is not just because you are criticizing Lisp, it is also because you are posting a bunch of BS without understanding the difference between a context-free and a context-sensitive language. Please learn some basic parsing theory and then you will understand why your suggestion for a white space sensitive syntax for a homoiconic programming language is nonsense.
- leoc 9y agoWell, there was SRFI 49, which wasn't very popular but was supported by Matthias Felleisen.
- 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).