PAIP: Run Common Lisp in Browser?
github.com
github.com
1: https://common-lisp.net/project/armedbear/
2: https://plasma-umass.org/doppio-demo/
[edit]
With the doppio demo linked, I get a REPL in about 2 minutes on chromium and under 5 on firefox. That's a huge improvement since I last tried.
Performance is not great though; I ran the gabriel "boyer" test and it was 0.288 second on openjdk 1.8 and 63 seconds on Doppio in chromium.
I recently added support for ClojureScript
b) Clojure didn't really fully succeed, there were annoying differences between Clojure and Clojurescript last time I looked. There are compilers for incomplete subsets of CL to JS as well, although presumably much worse ones.
c) There's some stuff in Common Lisp that's quite hard to do efficiently on top of most existing language runtimes. For example resumable exceptions and lua/CL-style optional multiple return values. In assembler or without concern for efficiency the last one is trivial, otherwise, not so much.
d) Clojurescript could bootstrap existing fancy JVM platform stuff (closure compiler) to do quite a lot of heavy lifting.
I think a modern multiparadigm Lisp on LLVM would be great. Perhaps that's Julia, though.
A) Writing a new Common Lisp implementation is a major undertaking, but a new implementation was creates specifically for C++ interop[1], and that implementation is certainly post javascript being big.
D) Anything targeting JS can run the output through closure; I've done so with Parenscript, for example.
D) Of course, but if you require some additional JVM based tooling for a JVM language like clojure, you lose 0% of your potential audience and introduce no additional friction, which is not at all the case for CL (nor would it be for, say C++ or Lua).
There are several CL implementations with deep C integration, for example by compilation to C. CLASP has deep C++ and LLVM integration. Some implementation can create shared libraries which are being loaded from other programs.
CLASP: https://www.youtube.com/watch?v=8X69_42Mj-g
It's possible to bring Common Lisp on top of runtimes like the JVM or Javascript - but there is some larger mismatch, because Common Lisp (different from Clojure) a platform independent full programming language. For example Common Lisp specifies a numeric tower with bignums, some float types, complex numbers and rational numbers. JavaScript internally does only offer floats. Common Lisp also specifies its own object system, which does not map well on top of the JVM (single inheritance, non-dynamic) or JavaScript.
For client-side I tend to use Parenscript[1] which doesn't particularly try too hard to look like Common Lisp, but does allow for macros to be written in Common Lisp. Since it's not trying too hard to look like Common Lisp, javascript interop is dead-simple, but since the metaprogramming is in Common Lisp, I find it to be a good middle-ground.
[edit]
If it's not clear, parenscript has design requirements that make it unable to ever be a full common-lisp on its own; the desire is that you could emit a webpage where e.g. the onclick property is generated from parenscript, and it will work, without any other javascript libraries being loaded. This obviously means you, e.g. can't have a lisp numeric tower available.
Oh look, a comment in this submission Github's item points to JSCL, for example.
I tried to run some of my CL stuff in JSCL, but the browser just froze, so I quickly gave up on that. Guess it can't handle more complex stuff.
I wonder if someone ever tried to compile a C-based CL implementation (like sbcl) to WebAssembly (i.e. using emscripten) ? I'd be surprised if nobody ever tried that, but I never read any reports regarding success or failure.
Does anyone know about prior works I could potentially contribute to?
Or someone could semi-manually create links for all the snippets?