The following is a frozen copy of a proposal that proposes computing code as functions. I am not now contemplating this but I keep the fragmentary ideas in this file.
I propose a small abstract language. It is scarcely more than Church’s lambda calculus. It takes from LISP the notion of executing functions whereas Church only argued equivalence between functions. I propose to add bounded arithmetic simply because neither LISP nor Scheme suggests how to print functions, which are the only values known to the lambda calculus proper. Church makes it clear informally, how to add numbers as primitives and also to implement formally them as functions. I want to try faking the sorts of numbers that Church builds form functions, but with the performance of primitive numbers.
I propose to represent functions as ‘code’. The quotes here are because I intend to design a dumb machine merely adequate to execute this code. The idea is a half page of C code that emulates this machine. It is unconventional to produce code as the values of a computation and perhaps this is just a funny way of talking. We shall see. This is not comfortable for modern machines which don’t like to execute what they have recently generated.
I propose no syntax except perhaps Polish notation, and perhaps another version faithful to Church. Better syntax if other ideas pan out.
When entering a function register 1 points to the argument and register 2 to the continuation. A continuation is a place to begin obeying code which expects a ‘result value’ in register 1. The function λx.x is coded with the instruction RET which goes to the continuation in register 2. The environ (static chain) in this story would be found in the code stream. An environ is null or a pair of words, the first of which is the value and the second is null or the remaining environ. I may follow Pierce’s suggestion of coding a variable as merely the static depth of the binding—an integer.
The normal mode of executing Scheme, and LISP, is to read a program and after it is all read begin executing a static version of the code. Functions are ‘calculated’ by pairing new environs with old program fragments that were in place just after reading the whole program. Is there a coherent plan for ‘computing new code’?