[Git][cmucl/cmucl][master] 2 commits: Fix #91: Handle loop destructuring

Raymond Toy gitlab at common-lisp.net
Sun Jan 10 04:33:13 UTC 2021



Raymond Toy pushed to branch master at cmucl / cmucl


Commits:
1144015f by Raymond Toy at 2021-01-10T04:33:03+00:00
Fix #91: Handle loop destructuring

The destructuring shortcut in loop doesn't require all the parts be
available.  If they're not, each item is replaced by NIL.

This is fixed by still using `destructuring-bind`, except we mark
everything as optional.

- - - - -
5b5082c6 by Raymond Toy at 2021-01-10T04:33:04+00:00
Merge branch 'issue-91-loop-destructuring-bind' into 'master'

Fix #91: loop destructuring bind

Closes #91

See merge request cmucl/cmucl!63
- - - - -


1 changed file:

- src/code/loop.lisp


Changes:

=====================================
src/code/loop.lisp
=====================================
@@ -995,7 +995,10 @@ collected result will be returned as the value of the LOOP."
   (if crocks
       (let ((*ignores* ()))
 	(declare (special *ignores*))
-	`((destructuring-bind ,(subst-gensyms-for-nil (car crocks))
+	;; Destructuring in loop doesn't require that the values be
+	;; available.  The missing elements are filled with NIL.  So,
+	;; make everything &optional
+	`((destructuring-bind (&optional ,@(subst-gensyms-for-nil (car crocks)))
 	      ,(cadr crocks)
 	    (declare (ignore ,@*ignores*))
 	    ,@(loop-build-destructuring-bindings (cddr crocks) forms))))



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/fdeafbc630fd3599062a68eafb3b82574cd34d9c...5b5082c6cbe682d5805630d4e92f858ea372def1

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/fdeafbc630fd3599062a68eafb3b82574cd34d9c...5b5082c6cbe682d5805630d4e92f858ea372def1
You're receiving this email because of your account on gitlab.common-lisp.net.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20210110/e0687007/attachment.html>


More information about the cmucl-cvs mailing list