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

Re: what does (declare (downward-function)) do?



   Date: Wed, 21 Aug 91 13:59:33 CDT
   From: engber@aristotle.ils.nwu.edu (Mike Engber)
   To: info-mcl@cambridge.apple.com
   Subject: what does (declare (downward-function)) do?
   
   The subject line says it all. I see no mention in Steele.
   I assume it allows for some optimization.
   -ME

DOWNWARD-FUNCTION will no longer exist in MCL 2.0 final.

It is a Lisp Machine concept providing an alternative way to declare
that a closure has DYNAMIC-EXTENT.  We decided to get rid of it
because the extent of the closure is confusing.

In 2.0b1 you can write:

(defun map+ (list value)
  (mapcar #'(lambda (x) (declare (downward-function) (+ value x)))
          list))

In 2.0 final, DOWNWARD-FUNCTION is no more.  The example becomes:

(defun map+ (list value)
  (let ((f #'(lambda (x) (+ value x))))
    (declare (dynamic-extent f))
    (mapcar f list)))

or:

(defun map+ (list value)
  (flet ((f (x) (+ value x)))
    (declare (dynamic-extent #'f))
    (mapcar #'f list)))