zzz6519003 / blog

My blog about coding
4 stars 1 forks source link

Interview with Rich Hickey, Creator of Clojure book note #100

Open zzz6519003 opened 7 years ago

zzz6519003 commented 7 years ago

Rich Hickey answered some questions for the readers of this book. He had a special interest in why this Lisp version could be more broadly successful than other Lisps, so this interview is a little more extensive than most. I hope you find his answers as fascinating as I did.

Bruce Tate: Why did you write Clojure?

Rich Hickey: I’m just a practitioner who wanted a predominantly functional, extensible, dynamic language, with a solid concurrency story, for the industry-standard platforms of the JVM and CLR and didn’t find one.

Bruce Tate: What do you like about it the most? Rich Hickey: I like the emphasis on abstractions in the data structures and library and the simplicity. Maybe that’s two things, but they are related. Bruce Tate: What feature would you change if you could start over again? Rich Hickey: I’d explore a different approach to numbers. Boxed numbers are certainly a sore spot on the JVM. This is an area I am actively working on. Bruce Tate: What’s the most interesting problem you’ve seen solved with Clojure? Rich Hickey: I think Flightcaster3 (a service that predicts flight delays in real time) leverages many aspects of Clojure—from using the syntactic abstraction of macros to make a DSL for the machine learning and statistical inference bits to the Java interop for working with infrastructure like Hadoop and Cascading. Bruce Tate: But how can Clojure be more broadly successful when so many other dialects of Lisp have failed? Rich Hickey: This is an important question! I’m not sure I would characterize the major dialects of Lisp (Scheme and Common Lisp) as having failed at their missions. Scheme was an attempt at a very small language that captured the essentials of computation, while Common Lisp strove to standardize the many variant dialects of Lisp being used in research. They have failed to catch on as practical tools for general-purpose production programming by developers in industry, something that neither was designed to be. Clojure, on the other hand, is designed to be a practical tool for general- purpose production programming by developers in industry and as such adds these additional objectives to the Lisps of old. We work better in teams, we play well with other languages, and we solve some traditional Lisp problems. Bruce Tate: How does Clojure work better in a team setting? Rich Hickey: There is a sense in which some Lisps are all about max- imally empowering the individual developer, but Clojure recognizes that development is a team effort. For example, it doesn’t support user-de- fined reader macros, which could lead to code being written in small incompatible micro-dialects. Bruce Tate: Why did you choose to run on existing virtual machines? Rich Hickey: The existence of large and valuable code bases written in other languages is a fact of life today and wasn’t when the older Lisps were invented. The ability to call and be called by other languages is critical, especially on the JVM and CLR.4 The whole idea of standard multilanguage platforms abstracting away the host OS barely existed when the older Lisps were invented. The industry is orders of magnitude larger now, and de facto standards have arisen. Technically, the stratification that supports the reuse of core tech- nologies like sophisticated garbage collectors and dynamic compilers like HotSpot is a good thing. So, Clojure emphasizes language-on-platform rather than language-is-platform. Bruce Tate: Fair enough. But how is this Lisp any more approachable? Rich Hickey: Lots of reasons. For example, we wanted to deal with the parentheses “problem.” Lisp programmers know the value of code- is-data, but it is wrong to simply dismiss those who are put off by the parentheses. I don’t think moving from foo(bar, baz) to (foo bar baz) is difficult for developers. But I did take a hard look at the parentheses use in the older Lisps to see whether the story could be better, and it could. Older Lisps use parentheses for everything. We don’t. And in older Lisps, there are simply too many parentheses. Clojure takes the opposite approach, doing away with the grouping parentheses, making it slightly harder for macro writers but easier for users. The combination of fewer parentheses and almost no overloading of parentheses renders Clojure much easier to scan, visually parse, and understand than older Lisps. Leading double parentheses are more com- mon in Java code, the horrid ((AType)athing).amethod(), than in Clojure code.

zzz6519003 commented 7 years ago

i'll fix the format later.......