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

Varia from Tektronix



I am forwarding this for Will Clinger at Tektronix:

With regard to the proposed starred change to page 145 of CLtL:

    (*) 145 ....Similarly, a function that takes a &REST argument
    should not destroy it because its top-level list structure might
    share with a list that the user gave as the last argument to
    APPLY.

This would imply that destructive operations on any list given as the
last argument to APPLY are also forbidden unless it is known that the
function being applied does not take a &REST argument.  The following
code, for example, would be in error:

(defun baz (&rest x)
   (if (numberp (car x))
       #'(lambda () (1+ (car x)))
       #'(lambda () 0)))

(defun kablooey ()
   (let* ((zog (list 3))
	  (bar (apply #'baz zog)))
      (setf (car zog) 'zag)
      (funcall bar)))

;;; William Clinger
;;; willc%tekchips@tektronix.csnet
;;; Tektronix Computer Research Laboratory