194 points · by jlturner · 10y ago · 303 comments
These days, I don't care at all — I just write great apps that work (fast). Some code runs on the JVM, some code runs in the browser, some runs in both places. I get to use an impressive set of libraries from at least three different ecosystems (Clojure/ClojureScript, Java, Javascript). I get to use fantastic languages with impressive concurrency support. I deliver applications which customers pay money for.
For me at least, Clojure made this kind of writing totally obsolete, in the span of several years.
It is not for embedded systems, not for Android (last I checked, it was very slow), and not for browsers. I believe that ClojureScript is probably what's going to take the crown, eventually.
Still, Clojure or ClojureScript missing a lot of things from Lisp. Restarts, for instance.
For example, if it wasn't for the existing JVM ecosystem of tools and libraries, I would probably end up creating my own undocumented, unportable, bug-ridden implementation of 80% of Netty. Instead, I just use https://github.com/ztellman/aleph
I challenge anyone to watch this lecture from Christian Schafmeister and say they are not impressed: https://www.youtube.com/watch?v=8X69_42Mj-g and https://www.youtube.com/watch?v=0rSMt1pAlbE
You've instantly inspired me to change career paths. This weekend I'm going to set up a home chemistry lab so that I may one day contribute to the amazing body of work you've started.
Does anybody on HN have some recommendations for learning intermediate chemistry? or setting up home labs? Just for context, I have math/CS degrees and have already taken introduction courses to physics, chemistry, and biology.
If you're interested in theory, then it's a whole other thing.
(I'm a chemist.)
Every couple of years I spend a couple of months with Lisp and then decide that I actually want to use Lisp to generate code in other languages. Recently I've been on a modern C++ kick, and have been really amazed at how Clang and LLVM are being used to do code indexing.
So, C++ + CL + LLVM + scientific computing ... wow!
"C++ templates are to common lisp macros as IRS tax forms are to poetry" so true.
Having spent time at the MIT AI Lab and having co-founded a company whose principal product was a Lisp/C hybrid, I think the challenge with mainstream adoption of both Lisp-like and functional languages is the syntax. There's an element of "don't use a programming language that's hard to hire for" but I think that's secondary as it never bothered us or posed a real problem.
Naughty Dog's Crash Bandicoot games (which I also worked on) used Lisp for all the character control logic.
Ironic(?) considering there is almost no syntax to Lisp.
But I generate and validate that Ruby code with Common Lisp -- in other words, I write Lisp that writes correct, idiomatic Ruby.
I would be very surprised if I were the only person doing this.
Lisp is more like research language than implementation language for bean counting apps. Better question is what bleeding edge things have originated, are being done or have been done in Lisp.
John Carmak is doing VR research with Racket.
Christian Schafmeister doing molecular metaprogramming.
Raytheon implemented a signal processing analysis pipeline for missile defense in Lisp
Commercial Lisp vendors keep lists of some of their customers. Specialized Cad programs like Bentley PlantWise are not popular but they are very complex.
There's also cl-abnf from the same author and project which is another great example of the expressive power of common lisp.
Also, everything Fernando Boretti does is awesome ;)
https://github.com/eudoxia0 http://eudoxia.me/article/common-lisp-sotu-2015/ https://github.com/dimitri/cl-abnf
- https://github.com/asciinema/asciinema-player
- https://precursorapp.com/ (not open-source)
Edit: Urbit has a Lisp (http://urbit.org/)
I'd only call this anecdote, but one or more benchmarks assert that cl-ppcre, common lisp's perl-compatible regex implementation, is faster than any other, include perl's.
The larger question I'm intuiting from your post, "Why doesn't language power make a difference in practice?" I don't have an answer to.
That question would be: what programs are written in <LANGUAGE> that couldn't benefit from being rewritten in another language?
And most often, the answer to that question is none.
Because languages matter a lot less than language fanatics want you to think.
As for Lisp, I used to be a total fan until I realize the importance of a sound static type system, and now I will never go back. Lisp will never go anywhere because this is the 21st century and we know now that static type systems are an absolute requirement for modern programming.
I am not saying that you are wrong in liking static typing, but arguing that dynamically typed languages are non-starters in this decade is a statement that is easily disproven by the existence of Javascript.
What remains is that the Lisp design contains numerous elements which are great ideas, which, if they are nicely implemented in their proper form, give you a great programming language.
That doesn't translate to being able to return to the time when you're showered with institutional money to just go wild hacking on whatever you like.
Some of the most popular languages today, from a web development perspective at least, are JavaScript, Ruby, and Clojure.
One of them is an actual Lisp with full-blown macros and a lot of Emacs users.
The others are also extremely expressive, dynamic, and amenable to metaprogramming.
I don't think there's a single, simple, beautiful explanation for why Common Lisp isn't more widely used. Mostly it just has an undeserved bad reputation... partly because articles like this show up all the time, reinforcing the stigma of Lisp as a weird language for bipolar geniuses, or whatever.
- Clojure user :)
1. Ruby + Clojurescript have prominent, opinionated community leaders who spend an immense amount of resources on proselytizing and preaching agreed-upon best practices (hell, 90% of Ruby development is done within a framework that all but forces you to write code in a particular, proven way).
2. As for JS: web developers are all forced to use it, which naturally leads to less fragmentation (if Chicken Scheme was the only scripting language available on a UNIX OS, by necessity some libraries would become dominant). Even then, most large enough JS codebases are ghastly.
---
Contrast that with Lisp/Scheme. I am now learning scheme, and love the language to point that it's depressing not to get to work in it on a daily basis. That said, the most impenetrable aspect of scheme/lisp is not the language, it's the community:
I don't think I'm exaggerating if I say that the entirety of the scheme community (with the exception of racket) is scattered into completely fragmented groups of under 20 individuals, all of whose landing pages look like they were designed in 1993, filled with broken and outdated links; libraries are maintained and abandoned willie-nillie, communication happens mostly in the form of mailing lists... where do I go to watch a talk? where do I read about latest libraries and projects? what are some of the agreed upon best practices?
"Read the SRFI" is not documentation (if you can figure out the relevant SRFI in the first place).
Example 1: this is the package manager Gambit Scheme recommends http://snow.iro.umontreal.ca/ -- a noble attempt at unifying scheme packaging across implementations. DEAD (as far as I can tell). And why? Because each scheme implements its own unique module system, implements its own unique subset of RnRS.
Example 2: need an LMDB library? Well, the chicken scheme version is a port of a version that exists only within the LambdaNative framework (which is implemented in a different scheme). Why does it have to be ported? because the two schemes have an incompatible way of handling c-bindings. So one can't just write a library that's R5RS compliant and assume it works across implementations. So we end up with two developers maintaining two versions of the same library, instead of both focusing on the same one. And when one of them decides to start using leveldb on his projects instead? The project is DEAD.
(I'm not arguing for a singular implementation of scheme. Part of the beauty of the ecosystem is the variety in implementations suited for different purposes. But so many of the incompatibilities are trivial, and are a community problem, not a technical one. If everyone agreed to implement, say, R7RS-small and better efforts were made to standardise the trivial, like how modules are defined, or how c bindings are to be declared, we could have a central repository of cross-compatible packages.)
The problem isn't the language or its power, it's a lack of community building efforts, which makes it extremely frustrating for a newcomer, even one who is absolutely enchanted by the language; and downright prohibitive for a company to bet on scheme.
Imagine you are a project manager, would you gamble the success of your company on a language whose libraries, as far as I can tell, almost ALL have a bus factor of 1?
tl:dr scheme needs a modern, newcomer-friendly, robust community portal. When there is one link I can give to people where they can find: practical tutorials, lectures, a quick overview of the ecosystem, portable libraries, books and articles full of tips and best practices, charismatic community leaders (who explain things in simple terms that don't scare off the uninitiated, as opposed to trying to convince you how much smarter Lisp programmers are)... then there will be no reason for the language not to be widely used.
The book The Scheme Programming Language http://amzn.com/026251298X is a good overview of the main libraries and language features, and has lots of examples.
Other than that, I've been learning mostly through google and trial and error.
You can find solutions to the first 7 chapters here: http://playpen.sixbit.org/studies/aop/
At the end of a day working on the Lisp portion, which assembled sketched lines into a CAD model I went home happy and relaxed with a feeling of accomplishment. At the end of the C days I felt tense and slightly worried, thinking about ways of more cleverly detecting what the user was trying to sketch on the tablet.
In my 20+ years of programming I never returned to Lisp and I don't quite know why I don't miss it. I have a vague nostalgia for Lisp but I think modern programming languages give us enough tools to get our job done without feeling too much shame about abandoning the purity of Lisp.
Also, the proselytizing has not helped. I think the "Blub paradox" article embodies the mindset that was ultimately the nail in Lisp's coffin.
I have a lot of warm fuzzy feelings about Lisp as well, but a lot of Lisp advocacy has been of the "One True Language" variety as opposed to "right tools for the right job, and here's why Lisp might be the right tool for you". It doesn't affect my perception of Lisp, but it doesn't help market it either.
The author makes an example of the many Object Oriented (OO) systems, but he performs some bait-and-switch there. Those many OO systems were for _Scheme_, not Common Lisp. And Scheme is intentionally a tiny Lisp. For a long time, Scheme was focused on being the smallest possible Lisp. Common Lisp on the other hand, while it briefly went through an OO experimentation period, really only has one OO system: CLOS.
Also, the whole Emacs line is off target too. What has that to do with the expressive power of the language? And why ignore the two extremely powerful commercial Common Lisp IDE's out there? So is the point that Common Lisp isn't successful because there isn't a better free IDE?
And the "lone wolf/80%" isn't doing it for me either. The Common Lisp specification was the work of many bright minds and is brilliant. And it stands in complete opposition to the situation the author attempts to describe.
I'm not saying that Lisp in general (Scheme, Common Lisp, and Clojure) has been successful, or that Common Lisp in particular has been. If the standard is mindshare and acceptance they have not been successful. There are histories and causes aplenty, but being too powerful is not one of them.
I wrote it during a period when I was especially fascinated with Lisp and got caught up in the theorizing to which the Lisp community can be prone. Nowadays, I freelance in front-end web development and doing Lisp hacking is something that I put on the back-burner.
I stumbled on LISP and Scheme around the time I graduated from high school in 1991. I became interested in LISP from learning about classic AI research. I found a professor my first year in college who mentored me in an independent study of LISP. I then learned scheme doing a self-study with SICP.
Despite all of this, I've never done any paid work in LISP, and I've spent the majority of my career writing C. I can't write a LISP program from scratch from memory any more.
However, I've found that the ideas of functional programming and the concept of the read-eval-print loop have colored my understanding of software design in a really positive way. I remember when I learned TCL in the mid 90s it was immediately obvious that TCL is just LISP on strings (read-substitute-print). Lua is also very LISP-like, with tables instead of lists.
There was, around 1990, a fad for "extensible languages".[1] It died, because the resulting code was so hard to read, with program-specific syntax for each program. Don't go back there.
> resulting code was so hard to read,
DSL code is the easiest to read and maintain. No "general purpose" language would ever match this.
> with program-specific syntax for each program.
As if it's something bad.
> Don't go back there.
You failed to understand the entire concept.
I don't think so. As the article states, this is a social/community issue, if every application has it's own language and syntax that is a huge barrier for others coming to work on it. You might not care about that but most large pieces of software are not written by one person. Beyond that you come to issues of code and skill reuse. A lot of people dislike the expressibility of Go, but it's hard to write code that someone else can't easily come and read and understand.
The article is plain wrong.
> if every application has it's own language and syntax that is a huge barrier for others coming to work on it
And this is quite obviously not true. A well designed (note the emphasis!) DSL makes any app/problem domain/library/whatever much more accessible than any kind of a "general purpose" language can. Simply because DSL does not obscure the essence of the problem.
> Beyond that you come to issues of code
Code reuse with DSLs is way beyond anything the inferior languages can achieve. I witnessed cases where 30+ years old DSLs got revived by reimplementing them from scratch, immediately making an entire (huge) code base available on a new platform, with new tools and bells and whistles.
> and skill reuse.
One should never care about those pitiful "language" skills. They're worthless.
Every application already has its own vocabulary, which is a huge barrier for others coming to work on it (seriously: try to check out the Linux kernel, or Firefox, or the Python interpreter, and try to start hacking on them).
Macros and custom syntax can help make that vocabulary more understandable, in the same way that functions can help make control flow more understandable.
Turing's original Universal Machine (you know, the moving read/write head over an indefinitely long tape of symbols) is not expressive at all; a simple task like adding two integers on that machine requires a completely arcane, verbose piece of gobbledygook to be prepared on the tape, where you cannot tell at a glance which part of it is the program, and which is the integers to be added. It is less expressive than 4 + 4 in a calculator language that doesn't have loops.
Expressive power is, in its barest essence, the freedom to assign an arbitrary meaning, from some domain, to a new combination of symbols, such that every symbol in that combination refers to some entity in that domain only.
It behooves us to have a general-purpose language with as much expressive power as we can get our hands on.
It is not hard at all to add restrictions in domain languages created inside an expressive language. For instance if you make an x86-64 assembler in Lisp, it will be just as restricted as any other assembler; it will diagnose unrecognized opcodes, bad addressing modes, etc.
I've written one such assembler in Common Lisp. It was rather straight-forward and generated nice code. Debugger came practically free.
Lisp is a language for symbolic computing. Values are not so valuable as computations and trees. If the level you're working at is too restrictive you're free to invent a new algebra for symbols at a higher level in terms of the lower-level primitive symbols. It's the same power one gets from manually calculating sums to inventing a language for expressing all sums. How you choose to represent things has great power in your ability to reason about them.
Check out Henry Baker's Comfy 65 Compiler[1] to see how far a little lisp changes an assembler language.
[1]: http://home.pipeline.com/~hbaker1/sigplannotices/sigcol04.pd...
But it won't enforce those things at compilation time in the type system, because it doesn't have one. You might have a macro that checks them, but it would be ad-hoc.
But [Lisp] won't enforce those things at compilation time
in the type system, because it doesn't have one.
What Lisp implementation do you have in mind? I ask because Common Lisp has type system that includes compile-time type checking. For example, SBCL:You can very easily write an assembler in Haskell that doesn't verify any of that stuff statically. Learning to do advanced kinds of static verification with Haskell's type system is actually rather difficult, and usually requires language extensions.
Using a macro that checks those things seems like it could be a very pragmatic way to provide safety. It might also let you verify properties that would be hard to figure out how to verify using only Haskell-style type checking.
Indeed, Haskell programmers often use QuickCheck to do ad-hoc verification of type class laws, for example, since they can't be proven in the type system.
The truth is that Lisp is not the right language for any particular
problem. Rather, Lisp encourages one to attack a new problem by
implementing new languages tailored to that problem. Such a language
might embody an alternative computational paradigm […] A linguistic
approach to design is an essential aspect not only of programming but
of engineering design in general. Perhaps that is why Lisp […] still
seems new and adaptable, and continues to accommodate current ideas
about programming methodology.
- Lisp: A language for stratified designThe thousand functions in a big C program are just as much a language, as some Lisp macros.
The functions all do something. That something isn't "transform the code", but that doesn't matter; if you're looking at the function call and don't know what it does, you're just as lost.
Basically, if you're reading Lisp, you go from "outside in" and just assume that everything you see whose definition you are not familiar with is a macro.
Well-behaved code follows certain unwritten conventions. For instance, it avoids creating confusion by exhibiting multiple completely independent uses of the same symbols in the same scope. So for instance if we have (frobozz a b) wrapped in a lexical scope where we have (let (a b) ...) in effect, this well-behavedness principle tells us that the a and b symbols in (frobozz a b) refer to these variables. So, we can probably lay aside our suspicion that, for instance, frobozz is redefining some unrelated a in terms of some unrelated b. However, frobozz might be a macro; so we can't cast aside our suspicion that either a or b has its value clobbered. (Same in Pascal or C++, with ordinary functions: frobozz(a, b) could take VAR parameters or references, respectively).
Which is not bad at all. You still have to do it with the programs written in the same language built with different libraries and targeting the different problem domains. In the latter case the language is obscuring the essence of the code.
And if you're using a well designed DSL, and you're familiar with the problem domain, it will be readable naturally, just like a pseudocode.
https://www.livecoding.tv/burtonsamograd/videos/
See the 'building a language' parts for actual lisp programming, the rest is JS webdev.
Sigil is a minimal lisp with only the basic primitives (cons, car, cdr, cond, null, atom, lambda and a few others) and macros. The project is an experiment in building a lisp from the axioms and seeing how far one can go without having to add to the underlying lisp implementation (which is in javascript).
That said, even if it were true that the power of lisp turned out to be it's curse, one should be careful to generalize this way about lisp hackers, 80% projects and lack of documentation. The language might tempt you to become the hacker portrayed in this article, but it certainly doesn't fight you should you want to follow best practices.
Members of the Lisp family seem to be judged by a different standard. I don't know why that is.
My perspective: the implementations attest to good documentation and collaboration. SBCL by itself is an admirable artifact with extensive documentation that's been maintaned since 1999 (when it forked from CMUCL).
So what gives?
"...The moral of this story is that secondary and tertiary effects matter....Employers much prefer that workers be fungible, rather than maximally productive...[in regards to creating a larger framework] The reason why this doesn't happen is because of the Lisp Curse. Large numbers of Lisp hackers would have to cooperate with each other..."
So here's what I see. I see a lot of frameworks and libraries composed by folks using other languages. Many of these, yes, are much more complete than one, totally-custom-made solution by some Lisp hacker. And yes, large numbers of people participate in creating and maintaining these larger frameworks and systems.
I also see large corporations bleeding cash because they wanted silo'ed, fungible programmers. Got seven architectural tiers, each with its own framework? Hell, you're going to need seven extremely specialized programmers, kid. Time to get on the phone with the recruiter.
So they purchase these specialists. All the buzzwords match. The specialists sit down at the magic frameworks, the ones all the cool kids over the last two years have decided to support. Life is good. For about ten minutes. Then something is required that's not in the frameworks. Or the framework is broken under this one particular edge case.
Suddenly we need somebody who's general purpose again. Except -- and this is especially nice -- that's not the guy we hired. So seven layers of experts sit struggling with seven oddball issues. Googling Stack Overflow. Hacking the crap out of things. Making a total mess.
And at the end of the day, if we're lucky, something ships. Something with little problems here and there that requires seven different areas of expertise to figure out. Plan on maintenance being fun.
The next day version 2.0 of the framework on layer 5 ships. Now if you want maintenance programmers, for layer 5 they have to know both version 1.0 and 2.0
More complexity continues. It's fun for everybody.
Compare this to the guy who uses a standard language, decades-old libraries, hacks out a partial solution (but good enough to ship) in a few days and then moves on to something else. Now tell me that the framework guys have a better technology development model. I ain't believing it.
I'm not saying become a lone wolf and never work with folks. I'm saying that "working with folks" can completely kill any kind of value you're trying to create. Do it wisely.
If Lisp flourishes, more people would get to use it at work.
Lisp not flourishing means less fun.
Also, when I've worked in Lisp it just seemed like the right way to do things. Everyone likes to do the right thing, so anguish results when you seem denied the opportunity to follow the path you feel is right.
That said, I think the author was right and the community issues and ease of building your own solutions will limit Lisp as a language family.
Because it's fun.
Is it possible to do the same in another language? Sure, Slack is proof that it's possible. But would I have persisted in actually doing it without any hope of profit? No, because programming in other languages is a chore, and the only light at the end of that tunnel is the finished product.
With Lisp, the journey is a reward of its own.
Yes, I know the same thing has been said by Haskellers and others, but I doubt it was ever said by a C++ programmer.
APL is less extensible in this regard (to my understanding, someone might prove me wrong). Smalltalk is probably on par, if you can model it with objects and methods/messages cleanly.
But in the end, for me, it's the idea of programming the AST directly and being (mostly) freed from arbitrary syntactical constructs.
To me, this hits the nail on the head, for all the wrong reasons. Syntax isn't the problem, implementing the feature is!
If I'm writing Lisp code, why do I want it to look like Erlang? What's wrong with it looking like Lisp? ("Erlang style concurrency and message passing" is two things, syntax and functionality. Do you want the functionality? Fine. You want the syntax too? Why?)
In fact, this is kind of what the article is about. People want the syntax "their way"; it makes it hard for others to work with their code.
The only time you should invent new syntax is when it is impossible (or very hard) to say something in the syntax you've got. "I don't like it" isn't good enough. "It will save me a few keystrokes" isn't good enough.
- The core library is has enough built in that many questions are answered using built in solutions (e.g. what is done with objects elsewhere is very frequently done with maps and functions that operate on maps) - The language designer (Rich Hickey) is very opinionated, and the language tends to attract people who agree.
There still are multiple choices when it comes to solving some problems (Om vs Reagent vs Rum vs etc.), but is that really that much different than other languages? Javascript has a million choices for the same domain.
The rest of us just shut up and hack some Lisp.
Assuming you have a good toolbox of operators, working with that kind of AST is not much harder than working with s expressions. Maybe it is easier if you can build a general notation that can be generalized for multiple languages and also represent more ordinary data such as json formatted, relational, rdf, etc.
The proof that it is so much harder is that no one ever does it. Yet people do this all the time in Lisps. If its "not much harder" I'd expect to see more of it, but I don't, because it is just so much work.
Aside from parsing, what about templating. Yes, you can manipulate the AST once you have it, but what would templating AST look like? Would it look just like the Java code? With the syntax quote in clojure it looks very much like the output. How would you even begin to template syntax in your hypothetical Java implementation?
Teams of people were required to write Haskell and Dr Whatshisname tossed off Qi by himself. OK, but people use Haskell, does anyone use Qi? If not, then it's not a problem for Qi to be 90% done. And that's a lot easier to accomplish by oneself.
Oh is it time already for another "C is for idiots" thread from Lisp supremacists again? If Lisp fanboiz were slightly less busy ridiculing the rest of the world over how stupid everyone else is, they might even have had some time to pay attention to silly things like performance and tooling. That might help the adoption a bit more than the supercilious rock throwing that is almost exclusively the tone of every single article/post from Lisp lovers.
Clojure is more than fast enough for serious server side programming, often coming close to Java in performance with minimum amount of tuning needed in the average case. When you add multithreading into the mix, it's not even a contest; the amount of time you'll have to spend to make an idiomatic Java or C++ run both correctly and fast is gargantuan compared to a language where concurrency was built-in from the start.