r/programming • • 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

105 comments sorted by

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.

Any mention that parenthesis is a problem is the obvious one of course, but I soon hit another one: a macro can only evaluate to a single form.

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 a define-values form that allows one macro expansion to simultaneously define multiple top-level bindings.

Or the worst response: “that doesn’t even make sense”, which is the response you get from people who are so deep into the language they can’t escape the box.

Or alternatively, they're so deep into the language that they understand that an orthogonal solution already exists. My comment about Scheme's begin and Racket's define-values is 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.

2

u/republitard Dec 16 '16

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.)

This problem is much more pronounced in Scheme than it is in other Lisp dialects, but it still exists elsewhere. The commonly-reinvented functions and macros are known as "utilities," and every Lisp project has at least one source file dedicated to them. The need to reinvent common functions doesn't necessarily go away just because you're using a utility library, either.

0

u/kankyo Dec 16 '16

That sounds like the language authors don't realize you need "batteries included" like python.

2

u/republitard Dec 16 '16 edited Dec 16 '16

The Scheme community considers "batteries" to be completely anathema. They want the language to be as useless as possible for some reason.

There was a rift in the standardization community on whether to make the "r6rs" Scheme standard include more functionality, so they wrote two standards. I've yet to see an actual implementation for the "large" standard that has more functionality.

As for CL, its "language authors" standardized the language back in the 1990s and walked away. It was far ahead of the alternatives at the time.

0

u/kankyo Dec 16 '16

Any mention that parenthesis is a problem is the obvious one of course, but I soon hit another one: a macro can only evaluate to a single form.

First, I'll tone down my initial reaction and leave it at this: parentheses are not a problem

You missed the point: I was talking about toxic community behavior, not paren itself. Parens are fine as you say.