Subject: Re: multiple-value binding let and let* From: Erik Naggum <erik@naggum.no> Date: 1999/08/18 Newsgroups: comp.lang.lisp Message-ID: <3143984828088049@naggum.no> * Dave Bakhash <cadet@bu.edu> | (let* ((x 3) | (y 4) | ((q r) (truncate x y))) | <body>) I prefer (let ((x 3) (y 4) q r) (setf (values q r) (truncate x y))) although I can see the value of these binding forms, we should not forget that DESTRUCTURING-BIND and MULTIPLE-VALUE-BIND go through a lot more work than they appear to be and that it's a lot harder to specify exactly how these things are supposed to interact with missing values than one might believe from watching the trivial cases. I note in passing that the generated machine code for the following two forms are identical in Allegro CL 5.0.1 for all the machines I have tested it on. (Duane?) (let (a b) (setf (values a b) (truncate pi 3)) (list a b)) (multiple-value-bind (a b) (truncate pi 3) (list a b)) | Personally, I'd like LET handle both MVs and destructuring. I think MULTIPLE-VALUE-BIND and DESTRUCTURING-BIND abuse indentation and clutter up the binding/setting distinction, and I see no reason why we should now fix that non-problem by cluttering up the meaning of binding so much we don't know what we're getting, anymore. when I use MULTIPLE-VALUE-BIND and DESTRUCTURING-BIND, it is around short pieces of code because I frequently need to rearrange the returned values before using them as arguments for another function call, or even to avoid the overhead of MULTIPLE-VALUE-CALL, which I would much prefer to be implemented at least as efficiently as APPLY (and perhaps with the same underlying machinery, even possibly exposed as an argument sequence). #:Erik -- (defun pringles (chips) (loop (pop chips)))