2023-05-06, updated: 2024-03-12

Tested with Nyxt -.

Tags: lisp.

Why Lisp?

Why Lisp?

By John Mercouris and Pierre Neidhardt

A lot of people ask us the question, why do we choose to use Common Lisp as our primary development language? Often times the question comes disguised as a suggestion: "Flask is a great webserver you should consider using". This is a well intentioned suggestion- of course we would like to use the best tools available! Below, we'll do our best to explain why we use Lisp, and why we think it is the best tool for our needs.

This is a difficult question to answer, because without knowing Lisp and the concepts from the language, it is impossible to deeply explain the benefits of said language. In the following article, we'll discover and briefly examine what makes Lisp a powerful and relevant language over 60 years after its conception.

What does it mean to be "future-proof"?

Future proof is a term thrown around a lot in the tech industry. People talk about future proofing a technology as if it is as simple as thinking of every eventuality, and implementing it. This task, even if you could think of every eventuality, would be infinitely long in nature.

Other programming languages get around this problem by simply doing nothing about it. They expose a set of functions, syntax, libraries, run-time environment to you, and then they say "this language is Turing complete and therefore should be able to do anything you want it to do."

Lisp takes a far different and far more pragmatic approach. The Lisp designers do not assume what syntax, features or functions will be necessary in the future. The developers of Lisp give you the full powers that they had to develop the language. You can develop macros for dynamically generating code. Without going into depth about how this mechanism works, a feat that was possible in Lisp was the implementation of an object oriented programming system without having to change the compiler!

What is longevity?

Many languages have evolved in ways that have necesitated backwards compatibility breaking changes. One of the most famous examples is that of the Python 2 to the Python 3 transition. This meant that all code written in Python 2 could not be leveraged in Python 3. The end result was millions upon millions of libraries and lines of code were rendered obsolete with official support ending in 2020.

On the other hand, Lisp code written some 30 years ago will most of the time, without issue, work on a modern Common Lisp implementation (there are a few compatibility edge cases from the pre-unification era of Lisps under the banner of Common Lisp).

What are the advantages of interactivity?

Traditional programming involves writing code, compiling code, and then testing the code. This is great if you can anticipate every single feature that you will want, or how everything should fit together. However, frequently, when embarking on a coding project, it helps to scratch some ideas down, and slowly build up concepts, learn things, decompose functions, and develop your program. Within the traditional compile-run loop, this process is very jarring, and takes up a lot of time.

Lisp solves this problem by introducing the REPL, and by being, for most implementations, image based. REPL stands for "Read Evaluate Print Loop." It allows for interactive programming. When you have a running program you can compile functions, redefine classes, etc. all while the program is running. You are changing the internal state of the image.

For example, you remove an attribute from a class definition. Your existing objects get (lazily) updated to reflect that change, following a rule you even have control upon. You don't have to restart a process and then re-create your objects. The same is true for Lisp web development. You can create a new route, compile it and try it live without restarting the server. You didn't have to restart a process. It's all very interactive with instant feedback!

Furthermore, should you encounter the debugger while attempting to run something, you can re-evaluate the function that is problematic, and continue the execution of the function again (from the exact same point)!

What more is there to say?

There is a lot more to say about Lisp and what makes it great. I suggest you take a bit of a dive into it yourself. If my article didn't convince you, there are a few others that might:

Getting Started

A quick way to try Common Lisp for yourself can be seen below, I suggest you give it a try! Best of luck!

An Editor

See also other editors (Lem, Atom, Eclipse, notebooks,…)

A Quick Introduction

More about Macros

More resources

Did you enjoy this article? Register for our newsletter to receive the latest hacker news from the world of Lisp and browsers!