In Scheme and most other Lisps, functions and macros belong to different worlds. A function receives the values of its arguments after they have been evaluated. A macro receives syntax before evaluation, and can decide what code should be produced. This split is useful, but it means that macros are handled by a separate mechanism.
Kernel tries to unify this picture. Its central abstraction is called an operative. An operative is a first-class combiner that receives its operands unevaluated. This is related to the old Lisp idea of fexprs, but Kernel gives the idea a cleaner and more formal design.
The primitive constructor for operatives is called $vau. It is similar in shape to lambda, except that the resulting combiner receives unevaluated operands. Ordinary function-like behavior is built by wrapping an operative. Kernel calls these ordinary function-like combiners applicatives.
This changes the role of special forms. Instead of treating them as a fixed syntactic category, Kernel lets programmers define new evaluation behavior as ordinary values. A conditional, a binding form, or a function constructor can all be described using the same underlying mechanism.
There is a serious cost. Fexpr-like systems are difficult to optimize. A compiler usually relies on knowing when subexpressions will be evaluated and what their values will mean. In Kernel, an operator may decide how to use its operands. An expression that looks like a normal argument may instead be inspected, delayed, ignored, or evaluated in a different way. This removes many assumptions that compilers normally depend on.
That tradeoff is what makes Kernel interesting. It gives up some implementation convenience in exchange for a very small and reflective core language. The result is not a mainstream programming language, but it is a useful language to study if you care about Lisp, macros, evaluation, or language design.
Kernel is also unusually attractive to implementers. The language is small, the central idea is sharp, and the formal specification is available in Shutt's dissertation. This seems to have produced a funny situation: there may be more Kernel and Kernel-like implementations than regular Kernel users.
For the official description, see John Shutt's Kernel page. For a lighter starting point, I recommend The Kernel Underground. For the full version, see Shutt's dissertation: Fexprs as the basis of Lisp function application; or, $vau: the ultimate abstraction .
If you are interested in small, unusual Lisps, Kernel is worth a look.
return home