The Lisp curse, now coming to your ecosystem
javahippie.net238 points by marcolinux 4 days ago
238 points by marcolinux 4 days ago
The real "[Common] Lisp curse" is that once you taste it, there's no going back.
Other than that, the Common Lisp ecosystem is doing well thank you very much. Many contributors to SBCL, regular contributions to the important ecosystem libraries, vivid projects (Lem), new editors (mine) and plugins (OLIVE), some companies picking Lisp and somehow supporting the ecosystem (hosting conferences, contracting implementors). https://github.com/CodyReichert/awesome-cl/ · https://github.com/azzamsa/awesome-lisp-companies/ And yes, new vibe-coded projects too. Some are useful (ICL, cl-tuition…), some reinventing the wheel (badly) went nowhere. For some, we'll see.
Since you mentioned the mine editor you must be aware of Coalton, but since you didn't mention Coalton I'll mention it here. Coalton is a Lisp library that basically adds static typing, type inference, and Haskell-style typeclasses on top of Common Lisp. (If you've never encountered type classes, then think of interfaces in the OOP language you know best. Type classes are what interfaces should have been: they can do everything interfaces can, and many things interfaces can't). Here's an example from the Coalton docs, which should be pretty self-explanatory; go read https://coalton-lang.github.io/manual/topics/whirlwind-tour/ if you want to see more.
(coalton-toplevel
;; Type classes are defined with the define-class keyword
(define-class (Eq :a)
(== (:a * :a -> Boolean)))
(define-type Color
Red
Green
Blue)
;; Type class instances are defined with the define-instance keyword
(define-instance (Eq Color)
(define (== a b)
(match (Tuple a b)
((Tuple (Red) (Red)) True)
((Tuple (Blue) (Blue)) True)
((Tuple (Green) (Green)) True)
(_ False))))
;; Type declarations can have constraints
(declare is-eql (Eq :a => (:a * :a -> String)))
(define (is-eql a b)
(if (== a b)
"They are equal"
"They are not equal"))
;; Multiple constraints must be wrapped in parentheses
(declare double-is-eql ((Eq :a) (Eq :b) => (:a * :a * :b * :b -> String)))
(define (double-is-eql a b c d)
(if (and (== a b) (== c d))
"Both pairs are equal"
"The pairs are not both equal")))For anyone who might not have encountered typeclasses before, the example might not be quite as self-explanatory as I thought it would be, so I'll explain that example a little.
The `(define-class (Eq :a) ...)` block is defining a type class called `Eq` with a type parameter named `:a`. Think of this as an interface that can be added after the fact. Most (all?) major OOP languages only allow you to declare interfaces when you declare a class, but in Haskell, and in Coalton that takes a lot of inspiration from Haskell, you can declare "interfaces" (typeclasses) on any pre-existing type, including ones coming from a library. Here, the `Eq :a` interface means that there must be a function called == (in Lisp even the operators are defined as functions) that takes two parameters of type :a and returns a Boolean.
`(define-type Color ...)` is defining a simple enum type. (You can do a lot more with it, of course, but this example is kept simple). Then `(define-instance (Eq Color) ...)` is saying "The type called Color is an instance of the typeclass (interface) called Eq". And since Eq requires a function called `==`, inside the define-instance block you have to define that function for the Color type. The pattern-matching should be simple enough that I don't think I need to explain it.
Now, the thing that makes this more powerful than interfaces is something I already touched on. Here the Color type is declared and then its typeclass instances are defined right away, which is the normal thing to do when you're creating a new type: keep all its code together. But if that Color type had come from another library that you imported, you would still be able to say "oh, and this Color type does implement Eq: here's the definition of == as applied to Color values". You're not restricted to only the interfaces that the library author thought to apply: you can take someone else's code and add interfaces to it! There have been several times when I really wished that were possible in C#.
Finally, the constraints before the => fat arrow are like declaring your function parameters as `public T isEqual<T>(T a, T b) where T : IEquatable`. This allows Coalton to catch, at compile time, any call to `is-eql` with parameters for which the `==` function is not defined.
There's plenty more at https://coalton-lang.github.io/manual/topics/whirlwind-tour/.
Thanks for the detailed explanation. I'm very familiar with Haskell, so this all feels very natural. How good is the type inference in practice? Is it a good as Haskell? And are there any places where you'd rather use vanilla common lisp?
Inference uses roughly the same algorithm and type system as Haskell (depending on what flavor of it... GHC has tons of extensions). It supports everything in the standard Haskell type system, as well as a few common extensions of Haskell, including multiparameter type classes, functional dependencies, etc.
About static typing and type inference: what does it do with code that it can't infer? It turns into a dynamic type ala Typescript, or it gives a type error?
I mean it must employ gradual typing, right? So that it can interface with existing code that is untyped
Coalton infers and checks all types for pure Coalton code; there's no such thing as a dynamic or untyped expression.
Code that is outside of the purview of Coalton—raw Common Lisp code—is run in explicit (LISP ...) forms [0] which require the user to annotate the type and they add dynamic type checks to ensure the enclosed code meets the contract the programmer specified (unless UNSAFE is used [1]).
If I've understood https://coalton-lang.github.io/manual/topics/whirlwind-tour/... correctly (and please do read it for yourself because I might be misunderstanding it: I haven't used Coalton yet, only read the manual), Coalton will guess a type in some cases (such as numbers, but not only numbers). I don't know whether it gives warnings or errors for types it can't infer, but since it's based on Common Lisp I would assume it would give a warning and continue with an unknown type.
But there are definite advantages to having Coalton know your types, which is why they give you a `(declare foo Integer)` form. This doesn't compile to any code, it's a compiler hint that tells Coalton that it can assume `foo` is an int, not a float64/double, which allows it to pick at compile time which implementation of + gets used in `(+ foo 5)`.
The 2025 video introducing Coalton at https://www.youtube.com/watch?v=of92m4XNgrM gives an example of what Coalton can do with knowing types. Robert Smith (the presenter, and the primary creator of Coalton) gives an example of a Fast Fourier Transform function that uses generic numeric types so you can call it on any number type: float32, float64, int-modulo-a-prime, whatever. He then benchmarks it, and it takes about 1 second to run 2 million times. Then he adds the single compiler hint `(monomorphize)` above the function declaration. This tells Coalton "Hey, instead of doing a dispatch table lookup in this function and calling different + implementations based on the type of the parameters, I want you to create two different copies of this function, one that will call the specialized float32 math functions, and the other one that will call the specialized float64 math functions." (Or three copies if you also called it with your int-modulo-prime number type). This eliminates a dispatch-table lookup and allows the compiler to produce much more specialized code. It comes at the expense of larger binaries, of course: he's explicit about how this is trading speed for size, so it's an opt-in choice you make (by adding a `(monomorphize)` declaration above the function definition) rather than something that Coalton defaults to.
But I've digressed. Yes, I believe (though note my caveat about not having used Coalton yet) that it would use dynamic types for code whose types it can't infer. But I'm pretty sure it would also give you a warning. If it gives you an error, the solution is to add a `(declare [name] [type])` line in the appropriate place.
Reading the first paragraph of the article, I agree with them that Lispers don't collect as many dependencies.
But then once I read the second paragraph, I agree with you. Lisp is doing fine in terms of important ecosystem libraries. The article sets that as the context when it asserts as fact that "established libraries are incredibly stable, tested by hundreds of thousands of developers, included in thousands of CI pipelines and maintained by experts on the topic."
I don’t really see that either.
I see that sbcl itself is alive and doing rather well, but other than that the landscape is fairly grim.
Unironically the most successful modern day lisp is clojure, that mostly piggybacks the jvm and can reuse most java libraries and frameworks.
The thing about lisp, it’s that it’s fairly expressive. You only need a few foundational libraries (mostly algorithms) and it’s very easy to build on the rest. In something like Python, or Go, once you define a conceptual model in a library, you need another library for the glue code to bind it to another ecosystem. In Lisp, almost everything is using the basic list, alist, and plist,…
So you design from the core logic and write shim to external dependencies. Instead of bringing deps from the get go.
> You only need a few foundational libraries (mostly algorithms) and it’s very easy to build on the rest.
Yeah but i don’t want to. Let’s say i need to connect to rds using iam authentication.
I don’t want to write code for that, i want to use a library.
I don’t want a library that works with chicken scheme but not on sbcl and maybe on cmucl.
I know i can, i don’t want to. I want to reuse code written and maintained by other people.
> I don’t want to write code for that, i want to use a library
All the people that had that need wrote code for that. And I guess they don’t want to do unpaid work by providing a full fledged library.
> I know i can, i don’t want to. I want to reuse code written and maintained by other people.
Then I guess Lisp is not for you.
Lisp missed its timing. When it was above and beyond everything else and a totally different world, it was way too expensive and way too inefficient.
Today, when mainstream languages have stolen much from Lisp, the benefit of using a language where you can generally just add a gem, egg, or crate is much higher than the benefit of the one thing that is still unique to Lisp: macros. Reflection is inelegant as hell when you compare, but it will get you almost all the way macros do.
At the same time, typed languages have become much more like dynamic languages. The types have disappeared into var and let statements; they are now inferred rather than repeated. Pattern matching has been added, and more—without compromising the benefits for larger teams and larger code bases.
Purists will disagree, but I haven't seen a real world problem solved in Lisp that I couldn't also solve in other languages.
And yes, I am interested in being proven wrong. I want to know what kind of problems still exist that are that hardcore. But I suspect a big part of it is that those who code in this still think the "hello world" for Java looks something like this:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
when in reality it now looks like this: void main() {
println("Hello World");
}
and in C# it looks like this: Console.WriteLine("Hello, World!");
And comes with full first class support for Linux and Mac.Lisp is an intellectual tower and has given an incredible amount to the programming community in terms of ideas and a playground for people to try things. I'm not denying any of that — it should be celebrated. But my thesis is this: most of that has been moved, copied, stolen, and adapted to mainstream programming languages.
>Purists will disagree, but I haven't seen a real world problem solved in Lisp that I couldn't also solve in other languages.
Turing completeness makes "I couldn't also solve" an impossibly high bar.
But if what you mean is, you haven't seen macros used in ways that make you wish your day-job programming language had macros, that's fixable.
Not GP and not Lisp programmer. But I'm curious about what you said. If you had to name one popular app or web service (>10,000 monthly unique users) that'd be much easier to clone in Lisp than in Python or Rust, specifically due to macros - what would that be?
I'm not active with any Lisp these days myself, either. Back in Web 1.0 days, when a lot of apps were transforming streaming rows of SQL results into grouped HTML entities, I used macros to implement something akin to SQL's LEAD and LAG, but at the application level. I don't have time, so I have to leave it as an exercise to the reader why it would take more verbosity to implement this in another language.
https://brl.sourceforge.net/brl_4.html#SEC31
Now, as a non-Lisper, I have to wait and hope the maintainers of programming languages I use will take useful syntax from other languages. Back when I was an active Lisper, I could take such syntax myself.
Is there any such syntax remaining? Sure, 20 years ago it was a pain to do manipulations of more than 1 element at a time. But nowadays everyone and their dog has some form of iterator combinators that make it a one liner. Even C++, although the line gets quite wide. Is there anything that, as of 2026, you seriously miss having in your day job language (and that language isn't Java)?
I'm having fun in TypeScript and only casually missing the capabilities of macros. It's Turing-complete, so doing the equivalent things is a simple matter of programming. And I'm almost always processing JSON structures, not SQL result rows, so I don't miss being able to write syntax like `sql-repeat` on a day-to-day basis.
Languages are no more Turing-complete than they were 50 years ago. If lack of Lisp macros was such a huge deal back then it affected day to day web development, then surely it must be affecting us all in this day and age too. Arguably, using JSON instead of SQL should make such macros even more important due to the unnesting of data we need to do. So why isn't it?
About today, JavaScript is good at referencing JSON. You don't need macros to make it better at it.
About back then, Perl/PHP/Python/Java/Ruby were never as good at pulling groups out of rows of SQL, but people could work around that by taking more time, writing more code, being more careful. So if you haven't seen macros used to make it better, you don't realize you're missing out on a huge deal. Maybe you just have a vague idea that things could be better, but you're too busy finding and fixing bugs to pursue this thought.