As we have shown above, continuations form a useful basic mechanism
for implementing dynamic evaluation. Dynamic evaluation itself can be
applied to many problems, which typically need a large amount of
non-trivial algebra code. This code is typically written in a high
level language, whose hosting platform is not able to handle
the creation of continuations. Conversely, languages that provide
continuations do not have a rich enough algebra library or type system
to implement some of the applications. Naturally, these
could be added, but this is a significant amount of work. The
A
compiler is used to bridge this gap.
As described above, there is the old implementation of dynamic
evaluation [Du], which has been translated into A
language. (not a major change, as the languages are very similar). The
principal user of this package, the dynamic constructible closure
domain, has also been translated.
These programs are strongly structured into categories, domains and packages, and so it has been very easy to adapt them to the use of the new tools. In particular there are only two major changes:
The old implementation of dynamic evaluation uses mutable variables in the dynamic constructible closure constructor in order to store the current case and the list of next cases. These variables are changed at a split point and allCases has access to these variables so as to control execution.
The mutable variable for the list of next cases disappears with the introduction of continuations, as the continuation effectively holds the necessary case information. This list of cases variable is therefore substituted with a variable that saves a list of outstanding continuations.
This rewriting allows one to use programs developed using the compiler to make use of dynamic evaluation -- for example a program using the Matrix domain formed over a dynamic field may be used unchanged in both a Scheme and C based environment.