Features Download
From: Douglas Crosher <dtc-sbcl <at> scieneer.com>
Subject: Call for support for lisp in the WebAssembly development.
Newsgroups: gmane.lisp.steel-bank.devel
Date: Thursday 4th February 2016 02:42:18 UTC (about 1 year ago)
A new code deployment standard is being developed for the web, named
WebAssembly. There is a W3C Community Group that people can join at
and development at

This work is an evolution of the JS asm.js standard now well supported
on the web.

I have been working to try and have the needs of lisp taken into
account, firstly via asm.js and patches across web browsers but this met
with resistance and the web browser vendors jointed to create the
WebAssembly project. I have also been working to have the needs of lisp
considered in the WebAssembly standard but have met resistance there
too. Although WebAssembly is a low level language I do believe that some
small changes here and there could help better support lisp.

For example, asm.js and WebAssembly have a sandboxed linear memory. This
requires bounds checking and/or memory protection schemes. One option
for lowering lisp code is to mask memory access indexes, and this mask
could both prove to the runtime that the index is within bounds, and
mask off tag bits. I've been able to demonstrate that this is often a
good win for C translated code too - quicker to mask than bounds check,
even set up a site with benchmarks at http://www.jsstats.com/ This
masking strategy would in turn require a power-of-two related memory
size, and there has been a lot of resistance to this too.

I have also had to fork out the development of a source code language
for the deployed code because the core WebAssembly team would not
support this. This seems practical and I have started the
https://github.com/wllang/ project
which has some initial tools for
importing and exporting the WebAssembly formats. Add some meta
information for source code comments and formatting and code patterns
such as a 'cons' allocation and 'car' and 'cdr' accesses and this could
start to look like a primitive lisp.

You can see the difficult in issues such as the following
'Wasm is a low-level
language. There can't be any expectation that it can represent every
convenience feature from a chosen high-level language 1-to-1.' I am just
trying to have the AST binary encoding be more efficient at representing
code patterns that discard excess values, not for wasm to adopt CL
argument passing and expression values. When the CL compiler can prove
that there are fixed return values it should be able to lower to
efficient wasm code.

There seems to be an opportunity here. Some chance to see better support
for lisp on the web, but the opportunity is brief. I have been trying
very hard but some support from other people in the lisp community seems

Douglas Crosher

Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
CD: 45ms