Newsgroups: comp.lang.lisp Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!hellgate.utah.edu!defmacro.utah.edu!moore From: moore%defmacro.utah.edu@cs.utah.edu (Tim Moore) Subject: Re: (setf (values ... Date: 14 Jun 91 13:37:46 MDT Message-ID: <1991Jun14.133747.17543@hellgate.utah.edu> Organization: University of Utah CS Dept References: <1991Jun13.204847.5625@jpl-devvax.jpl.nasa.gov> <1991Jun13.170657.23523@hellgate.utah.edu> In article fy@lucid.com (Frank Yellin) writes: > >Tim Moore gives the following setf method for values: ... > >I have three very minor nits. And they really are minor. I'd be very hard >pressed to write real code for which the above didn't work. > >Nit #1) The above code lets each of the 's in (values .. ) >itself have a multiple-value setf-method. Does this really make sense? >Does (setf (values a b (values c d) e) ...) really mean that I want "d" set >to nil? Yes, according to X3J13 cleanup issue SETF-OF-VALUES. This was passed at the March 1991 meeting: Proposal (SETF-OF-VALUES:ADD): Define VALUES as a SETF place in the standard. For a form such as (setf (values .... ) ) the setf methods for each of the nested are obtained as if by GET-SETF-METHOD-MULTIPLE-VALUE. The order of evaluation is as follows: (1) subforms of the nested are evaluated in left-to-right order. (2) The is evaluated, and the first store variable from each bound to the values as by MULTIPLE-VALUE-BIND. If the setf method for a nested involves more than one store variable, then the additional store variables are bound to NIL. (3) Finally the storing forms for the nested are evaluated in left-to-right order. Note that (as required by CLtL), the storing form for SETF of VALUES returns the values of the store variables as its values. (This might be more or fewer values than what the returns.) > >Nit #3) The specifications in CLtL2 allow the "newvar" list to be empty! >Sort of silly, but perfectly legal. The above code implicitly believes >that each newvars list (what is called these-store-vars in the code) >contains at least var. Yup, you're right. -- Tim Moore moore@cs.utah.edu {bellcore,hplabs}!utah-cs!moore "Ah, youth. Ah, statute of limitations." -John Waters