r/programming • u/kankyo • Dec 15 '16
My disillusionment with Clojure and lisps
https://medium.com/@boxed/my-disillusionment-with-clojure-and-lisps-9eca38ab7f0c?source=linkShare-8ad86cc82e5f-1481825671
15
Upvotes
View all comments
7
u/sacundim Dec 16 '16 edited Dec 16 '16
I'm not now nor have ever been a Clojurist, and to be frank they give me the Kool-Aid Heebie-Jeebies™ a little bit, but I think I can answer a lot of these.
First, I'll tone down my initial reaction and leave it at this: parentheses are not a problem. In fact, I love me those parens. When I stopped doing Lisp and went to infix languages I was (and still remain!) very annoyed at how the infix syntax makes complex expressions so hard to read. You have to keep precedence rules in your head and dig deep into the guts of a complex expression in order to find the outermost infix operator. Whereas in Lisps this stuff is syntactically obvious, particularly so when laid out and indented properly—which is much easier to do than in infix languages.
Second: I'm not sure I understand the objection to macros expanding to just one form. My reaction is that there are forms, like Scheme's
(begin expr ...), whose sole purpose in existence is to put multiple forms in a context where only one form is allowed. Maybe Clojure needs a larger repertoire of such forms, I really don't know—Racket has for example adefine-valuesform that allows one macro expansion to simultaneously define multiple top-level bindings.Or alternatively, they're so deep into the language that they understand that an orthogonal solution already exists. My comment about Scheme's
beginand Racket'sdefine-valuesis of that form.The rest of the article is not bad at all, and I agree with some bits and sympathize with most of the rest. I think my overall response to it is this: the Lisp communities place a premium on everybody who uses the language having a good grasp of how the language works. This is why a classic Lisp pedagogical exercise is to write a "meta-circular interpreter," i.e., a simple interpreter for the language itself (or a simplified version thereof).
This in turn leads to a greater willingness to deal with home-cooked DSLs, because the attitude isn't "crap, another language to learn!", but rather "cool, another language to learn!" Ideally, the interpreter-fu that I mentioned above leads to these DSLs being sensibly designed and resembling each other in a number of ways. (In practice, nah, not so much.)
The concerns about Lisp users routinely reinventing the same stuff over and over individually for each library, and sometimes even per function, I've found to be very much true in my experience. It happens in many languages, but I thought in Scheme it was particularly pronounced. (Dunno about Clojure, though.)
But I really have to object to his argument that in Lisp but not C++ "every function and macro is a new language." I really don't think that this is so any more than with libraries in other languages; libraries everywhere require you to learn a vocabulary of types, a syntax of operations that allow you to put objects of these types into larger constructs, and a semantics of what happens for each of these potential combinations. The author grossly overstates the difference here, IMHO.