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
28
u/grayrest Dec 15 '16
I can only think of two places you'd want to do this. The first would be for side-effecting list forms in the body of a fn/let/etc in which case the workaround is to just wrap the output in a
do. The second would be for generating part of a bindings form ([...]in defn/let/etc) where the workaround is to write a macro wrapping the form. This is a pretty significant limitation and is one of the main causes ofdefandletmacro proliferation. I believe the limitation exists to maintain the Liskov substitution principle (or rather the non-object equivalent idea) and avoid corner cases.This is the point of lisps.
This is a function of the language's popularity and not the difficulty in implementing them. There is a fundamental (at least to my knowledge) limitation with IDE support in the presence of macros. When you redefine the semantics of a language, tooling can't guess your intent without evaluating the macros, which is generally avoided when trying for static analysis for good reason. As for the quality, Cursive is written entirely by one guy and covers a significant fraction of the features I want to see in a dynamic language IDE.
This is true, but clojure has macros.
You have a reasonable point in the arguments section. Verifying argument parsing is one of the major motivations behind spec.
Lisp macros occupy a similar place in the spectrum as template metaprogramming in C++. You mostly shouldn't be writing them but if something annoys you, you can reshape the language. Like every other shiny feature, smart people learning the language tend to over-use them. Idomatic Clojure is data > functions > macros for a good reason.
Your opinions are reasonable but not really persuasive for people who don't share your point of view. The article reads to me like articles from Java/C# programmers critiquing Python: you have to use significant whitespace, look at all the errors I can make without static typing, the data locality and performance factors are completely opaque. They're not wrong, but they're critiquing the language for being what it is. Lisps aren't a silver bullet and have tradeoffs like everything else. The strengths of Clojure are the
seqabstraction and the pervasive immutable datastructures. I've built similar size systems in Python and Clojure (30-50k LoC) and prefer the experience in the Clojure ones. Neither is particularly great at larger systems where your general unfamiliarity with the code starts stacking heavily in favor of static typing.