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

An alternative to ACCEPTS?

   Posted-From: The MITRE Corp., Bedford, MA
   X-Alternate-Route: user%node@mbunix.mitre.org
   Posted-Date: Fri, 01 Sep 89 10:41:58 EDT
   From: ramsdell@linus.mitre.org
   Date: Fri, 01 Sep 89 10:41:58 EDT

   [This is not part of the multiple values compromise.]

   As an alternative to providing ACCEPTS?, maybe we should simply
   provide a way of generating truncating continuations.  Suppose we
   provided a procedure like CALL-WITH-CURRENT-CONTINUATION, except that
   if the escape procedure generated by CALL-WITH-CURRENT-CONTINUATION
   accepts exactly n arguments, the new procedure generates an escape
   procedure which will accept n or more arguments, and ignore the extra
   ones.  The advantage of this approach is that implementations are only
   required to be able to compute the arity of escape procedures, not all
   procedures.  Here is an example of its use:

       (define (quotient-and-maybe-remainder n1 n2)
	      (lambda (k)
		 (let* ((q (quotient n1 n2))
			(r (- n1 (* q n2))))
		    (k q r)))))

   (quotient-and-maybe-remainder 1 1) => 1


I would be unhappy with a special mechanism that handles only half of
the interesting cases.  It virtually guarantees that no mechanism
which handles the entire problem will be adopted in the foreseeable
future.  This is particularly true in this case in which their is no
natural extension of the special purpose mechanism to a more general one.
Morry Katz