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

call/cc and proper tail recursion



   Date: Sat, 14 Nov 92 18:00:27 -0500
   From: "Aubrey Jaffer" <jaffer@martigny.ai.mit.edu>

      I think the report needs to clarify the tail recursive property of
      call/cc.

   I think so also; It should be clarified to NOT require
   CALL-WITH-CURRENT-CONTINUATION be tail-recursive.

While we are on this topic, there are 2 places where the requirement
for tail-recursiveness becomes unworkable.  DYNAMIC-WIND is one:

(define (foo)
  (DYNAMIC-WIND (lambda () #f)
		foo
		(lambda () #t)))

And the other is some form of EVAL (which will be part of R5RS).

(define (foo) (EVAL '(foo)))

There are only 3 other essential procedures for which
tail-recursiveness can be a problem, CALL-WITH-CURRENT-CONTINUATION,
APPLY, and FOR-EACH.  CALL-WITH-CURRENT-CONTINUATION has been
discussed already.  I think that APPLY and FOR-EACH should be exempted
from the tail-recursive requirment.

If one calls APPLY and FOR-EACH using the native subroutine call
conventions on most computers they will not be tail-recursive.  It
seems a shame to deny conformance to implementations soley for the
sake of these 3 procedures.