The Next Lisp:
Back to the Future
©
Dr Mark Tarver, 2009
The
Kernel Lisp Project: Back to the Future
When I started thinking of porting Qi to other
members of the Lisp genotype I looked at the CL
sources for Qi. They are amazingly small. About
8,500 lines from 2,000 lines of Qi. Because I'm a
conservative coder nearly all of Qi is running on
the Lisp 1.5 core. In all there are about 68
primitive functions in Qi and many of them like
CADR are not really primitive. If we talk about
kernel functions meaning the stuff
that is really primitive then were down to
about 50, if that.
This kernel defines a Lisp, call it Kl, that is the kernel
necessary to run Qi. Now the interesting bit is
that Qi is mapped to Python etc. through a
mapping from the Qi-generated Lisp source to the
Python language. So by mapping Kl to Blub, you get a
version of Qi that runs under Blub.
Based on this idea, this opens the prospect of a
new Lisp that would be effectively a virtual
machine for the entire Lisp genotype. Kl would and should be an
enhanced version of Lisp 1.5, getting back to the
roots of Lisp. By defining Kl and running Qi and the
Q machine cross-compilers on Kl, we get a unified
platform for the entire Lisp genotype with Qi
functionality; state of the art thinking in
functional programming across the genotype
spectrum.
This process I call kernelisation is
going to change the shape of a lot of computing
in the next decade, in the way that RISC changed
hardware in the 80s. In particular the
Babel-like profusion of different languages we
have at the moment will be tamed through this
technique. Kernelisation is really the computing
analogue of formalisation - that
expression of the mathematician's hunger for
simplicity in the expression of formal systems;
the fewest primitives and the fewest axioms
needed to derive what we take as true.
Formalisation issued in a rich developments of
mathematical logic like Zermelo-Frankel set
theory and it was used to tame the wildness of
C19 mathematics. Today I see us as poised to tame
computing in the C21 in the same way.
Back to Lisp. What should Kl look like? I've already
given one answer relative to Qi; that it should
incorporate all the functions necessary to run
Qi. But Qi is itself not complete as a language
specification. For example in Functional
Programming in Qi I dont deal with how
to interact with streams. The reason I dont
deal with this and other such issues is that CL
already deals with them and I assumed those
people who wanted to learn how to do this would
learn CL. But if Qi becomes portable across the
Lisp genotype then that aspect will have to be
addressed.
Hence the shape and the form of Kl is not determined by Qi
even though it should support Qi. But the general
shape and form are, I think, reasonably clear.
There has to be several components of Kl.
1. A Turing-equivalent
subset based on classical functional
programming. This subset should be really
really small. For instance you can build
a decent functional model using if, =
(generic equality), basic arithmetic and l (for abstractions).
Cons, car and cdr are all l definable. All the
utility functions go into a standard library.
2. It should be dynamically typed but
support detailed type annotations.
Qi can provide a wealth of detail about the
types of Lisp expressions which compilers can
eat up. Kernel Lisp needs to be able to use
this.
3. It should support arrays, streams,
concurrency, error handling and threads in a
straightforward way. CLErrors is
tiny but does what I need. One objection is
that we still don't know how best to handle
concurrency. But that does not matter, we can
decide conventions on calling concurrency and
leave it to developers to decide how to
implement it.
4. There should be an open source,
freely available Kl library for
CL. CL survives in library form. CL
developers can load this library. Kl would be an
enormous help for implementers of CL. Right
now there is too much reduplicated effort
going on in a small community for CL to
prosper. Putting all the stuff in a library
would leave developers free to optimize Kl and would improve
Lisp performance no end.
To
continue with the biological metaphor, Qi has
wonderful viral characteristics; it is small and
easy to move and because of its conservative
encoding it will fit comfortably into Kl. Once established on
top of any instance of the Lisp genotype it forms
a symbiotic relation with the host language
improving the general well-being of the language
it infects.
Mark
|