The Revenge of Finalizers
Alastair Reid
alastair at reid-consulting-uk.ltd.uk
Thu Oct 17 08:42:47 EDT 2002
Ross Paterson <ross at soi.city.ac.uk> writes:
> there's an unsafe use in evalName(),
I think this is easily fixed by using malloc to allocate the buffer
and then tracking down all uses and calling free.
> and I don't understand the mutual recursion between eval() and run().
Not sure what you don't understand here so let me sketch my understanding:
eval traverses the graph looking for the next redex and then calling
an appropriate C function to apply the reduction. One of these
reducers is the bytecode evaluator 'run'.
run evaluates bytecode which both constructs fresh bits of graph and
implements the evaluate/test part of case expressions. When
evaluating case expressions, it has to trigger evaluation of the
selector which it does by calling 'eval'.
Without studying the code in detail, I believe that this recursion is
safe because run is a critical part of non-monadic evaluation - if
there were problems here, we'd have found them a long time ago. Of
course, this naive belief might be shattered if I were to actually
look at the code in detail.
--
Alastair
More information about the FFI
mailing list