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/fdeafbc630fd3599062a68e...