Skip to content

Instantly share code, notes, and snippets.

@alandipert
Created January 21, 2020 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alandipert/cb5def6eec333926e50b672a407b25ab to your computer and use it in GitHub Desktop.
Save alandipert/cb5def6eec333926e50b672a407b25ab to your computer and use it in GitHub Desktop.

JACL (JavaScript Assisted Common Lisp) is an experimental Lisp system for the web browser platform. It was created to explore new techniques for large-scale SPA (Single Page Application) development in Lisp.

Specifically, the project goals are to:

  1. Implement a useful subset of CL
  2. Interoperate efficiently with JavaScript
  3. Host as much development tooling as possible in the browser so that tools may organically evolve with the applications they’re used to build
  4. Support the delivery of applications competitive in size and speed with respect to those produced by JavaScript tools

Why not JavaScript?

The JavaScript language is Lisp-like in that it is garbage-collected, dynamically typed, and multi-paradigm. However, developing applications incrementally in a REPL in the traditional Lisp way is not well supported because JavaScript does not have a system of first-class global names.

JavaScript modules are files that represent a closure, and the entire file must be reloaded in order for the names exported by the closure to be re-instantiated. Dependent files must then also be reloaded. The necessity of reloading whole programs after making small changes orients JavaScript toward batch development workflows traditionally associated with statically-typed languages (and away from the incremental workflows traditionally associated with Lisp).

A testament to this trend is the growing popularity of JavaScript with type inference extensions. Despite JavaScript being manifestly typed, the JavaScript REPL experience is so impoverished that developers find more value in running their type checker than in running their program interactively.

OK, so why not add first-class global namespaces/packages to JavaScript?

A good namespace system could be built as a library, but because programs are filled with references to library functions — and because each reference would necessarily look like a field access or function call — the code would be quite noisy. Global names would also need to be installed using something like a function call.

Thus, a namespace system requires syntax support in order to be practical. The best syntax support possible, for anything, is Lisp syntax.

OK, but why Common Lisp (CL)?

In short: because it’s good enough. Despite its warts, CL is a well-specified and multi-paradigm language. Most importantly, it is a proven substrate for performing incremental development and prototyping new ideas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment