[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: requiring proper tail recursion




   Date: Tue, 02 Sep 1997 10:13:25 -0500
   From: William D Clinger <will@ccs.neu.edu>
   References: <199708291400.KAA25450@kima.nj.nec.com> <ogtyb5jttwn.fsf@laozi.mitre.org>

   EVAL is probably a bit more controversial.  It appears to me that
   requiring EVAL to evaluate its argument within a tail context might
   rule out implementations that implement a fully reflective tower of
   interpreters.  It might also rule out implementations that must
   perform some kind of context switch when transferring between native
   and interpreted Scheme code; several existing implementations do
   this, and have good reasons for doing this.

The tail-recursion requirement does make it harder to implement
a mixed native-code/interpreted system, but the problem isn't
with calls to EVAL itself.  Given an EVAL that does not evaluate
its argument in a tail context it is easy to write an EVAL that
does (modulo problems with LAMBDA having a nonstandard binding
in the specified environment):

   (define tr-eval
     (lambda (exp env-spec)
       ((eval `(lambda () ,exp)
               env-spec))))

                               -Richard