[r6rs-discuss] FW: A guideline for designing Scheme
Anton van Straaten
anton at appsolutions.com
Wed May 9 04:19:40 EDT 2007
From: J. A. "Biep" Durieux
Sent: donderdag 26 april 2007 13:12
To: 'r6rs-discuss at lists.r6rs.org'
Subject: A guideline for designing Scheme
[Tired and isolated.. :-)]
Instead of coming with some overly late reactions to discussion topics,
let me describe a possible framework for thinking about what we want
Scheme to be. The Dutch "Wijsbegeerte der Wetsidee" (WdW, "Philosophy
of the notion of Law", which came up in the 19th century) recognises
"law-circles" or modalities, which are best explained by exhibiting
their dependency lattice (which amazingly turned out not to branch: it
was a line). (Remark that (a) I provide an ancient version of the line
here, (b) philosophers disagree on details, and (c) its exact contents
or supposed linearity are not relevant to my proposal.)
1 existence; 2 quantity; 3 space; 4 time; 5 life; 6 feeling; 7 logic; 8
history; 9 language; 10 social intercourse; 11 economy; 12 aesthetics;
13 law; 14 ethics; 15 religion.
(As this was pre-Frege, 7 concerns psychological logic.)
This is to be read as: quantity requires existence, space requires
quantity (& existence), time requires space (& quantity & existence),
etc., but not the other way around. And each of these modalities has
its own set of laws that govern it.
- A higher modality can be REPRESENTED in its predecessor: space can be
represented numerically; time as a new dimension, etc.
- A lower modality can be ANALOGISED in its successor: the real line or
complex plane; a machine as an organism, etc.
- A lower modality returns as an ASPECT in each higher one. So biotic
time or psychic time exist, but not numerical time.
- But: each modality is sovereign, and cannot be mixed. One cannot
understand the timiness of time (4) by seeing it only as a line (4), or
life (5) or qualia (6) from their mechanical (4) representation only, or
explain ought (14) in terms of must (13), etc.
(Historical note: the Free University in Amsterdam owes its existence
and name to the WdW conviction that education (10) ought to be free from
state (13) and church (15) interference. As Andy Tanenbaum developed
Minix there, Linux might not have existed without WdW.)
Now what is this to Scheme?
A maximally useful programming language should cover the lower end of
this line optimally, so that higher modalities can be easily represented
in it. In fact, it ought to give precedence to completing its coverage
of lower modalities.
The computational universe being different from the external one, the
first modalities should probably be control and truth rather than
existence. Scheme covers that with the lambda-calculus with efficient
tail-recursion. (As everything else can be represented in that, Scheme
could theoretically have stopped there.) The Turing machine covers the
same ground as the lambda calculus, but mixes the modalities in a lack
of orthogonality. As a result, abstraction, representing higher
modalities, is often trivial in the lambda calculus, but hard and
error-prone work on the Turing machine.
Call/cc, force/delay, and a few other mechanisms extend this modality
Truth is covered with, booleans, boolean operations and conditionals.
Of course, in lambda calculus, if you need IF, you just write it, but
Scheme rightly provides it anyway.
The same with numbers. Bignums and the full numerical tower put Scheme
again ahead of many other languages.
Structures (cf. space) may be next. Scheme has garbage collection, and
lists/pairs, vectors, strings, but I think here more work is needed, and
the committee seems to recognise this: bytevectors, records and hash
tables are proposed. WdW encourages thinking hard about what it would
mean to cover the modality of structures, in the same way the numerical
tower covers the modality of numbers or call/cc that of control. (In
another context, I should have written "space" instead of modality.)
After that may come mutation (cf. time). Here Scheme is (I think
wrongly) a traditional language.
And after that? Objects? (Maybe actors :-) ). It is up to the Scheme
community to work out the lattice of modalities for the computation
The beauty and power of Scheme is that is has so far done an
exceptionally good job of covering the lowest modalities, especially the
control modality: Scheme without lists, or without numbers would still
be Scheme; Scheme without lambda very definitely wouldn't.
So what does this exposé intend? Basically: helping setting priorities.
As I said, this is a framework. It may help guiding thought about where
and how Scheme ought to grow, by proposing the right questions, such as:
1: What does the computational modality lattice look like (especially at
the low levels)?
2: What gaps in the coverage of lower modalities still exist?
WdW helps finding spots to which wrongly no thought is being given.
4: Does each implemented modality have the correct API, with its own
type structure to maintain its sovereignty?
Consider e.g. mutation - currently rather run-of-the-mill and without
its own type. I once suggested something ML ref-like (underneath -
invisible to legacy programs) which simplifies the semantics of Scheme,
turns set! into a function, and provides automatic (set! (car pair) x)
functionality, and immutability-by-default on the underneath level. My
idea was rejected, and may well have been the wrong way to go, but are
we sure the current approach is the correct one in the Scheminess sense
5: Do we want parallel solutions? Unification? Sets, lattices, ideals
- other algebraic structures than numbers?
Sometimes not (unification), but can we formulate why? Sometimes so,
maybe - the number of (often unrecognised as such) implementations of
sets in existing Scheme programs is staggering. Maybe Greenspun's tenth
law is really about modalities: if a language does not provide a (good)
API for a modality, it will force the programmer who needs it to write
(a better) one. The lower modalities being always needed, every large
program ends up containing a version of them closer to the optimal
solution, which is close to Lisp.
2: Where does a proposal fit, and what does that mean for its fate?
As an example, Unicode goes rather high in the traditional lattice: at
level 9 or 10. If that is true for the Computational lattice as well,
Scheme might not yet ready for its own, radical solution (like fully
parenthesized prefix as against the mixed notation the rest of the world
uses). Unicode interface libraries may be the only thing Scheme ought
to offer for the time being - we may not be ready yet to think through
what *the* correct way to deal with notation systems is. If Scheme is
to settle now for native unicode, it might stunt the growth of a correct
solution for ever in its effort to go where the masses go.
(This is not a proposal, but an example of how thought might go.)
Let Scheme remain the language that either does the right thing or
defers a final decision.
J. A. "Biep" Durieux - rrrs at biep.org (Please reply here rather than to
the address I had this sent from.)
More information about the r6rs-discuss