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

Issue: MAPPING-DESTRUCTIVE-INTERACTION (Version 1)



I favor the general idea of MAPPING-DESTRUCTIVE-INTERACTION:EXPLICITLY-VAGUE,
but I have two comments:

Do we want to follow the lead of MAPHASH in explicitly defining that
destructive operations are permissible on the entry currently being
processed?  For example, is
  (let ((l (list 0 1 2 3 4)))
    (dolist (x l)
      (when (oddp x)
	(setq l (delete x l))))
    l)
a valid program that returns (0 2 4)?  Note that making this valid
seems to imply a restriction on the implementation of DOLIST, that
it must call CDR before evaluating the body, not after.  Personally
I don't care whether this practice is allowed or forbidden.  Being
consistent with MAPHASH might lead to a clearer language.

The proposal needs to be expanded to include a complete list of
the functions affected.  It also needs a clearer definition of
which destructive operations it covers.  For example, I imagine your
intention was to forbid SETF of CDR but to allow SETF of CAR, inside
of DOLIST.  However, you didn't say that explicitly.  What about
destructive operations on vectors?