X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fmacros.lisp;h=48af2fb0f814f4623d661c7e125b2790716efec0;hb=1e1ba5d5b43e20a4c0b157f08d4c85fe880c7e25;hp=66b034d5dd98ee6c8ddea7a4e56beba123dc6cec;hpb=f181ad9ffeeadf341b6a16c3591eadf0c1e3fa61;p=sbcl.git diff --git a/src/compiler/macros.lisp b/src/compiler/macros.lisp index 66b034d..48af2fb 100644 --- a/src/compiler/macros.lisp +++ b/src/compiler/macros.lisp @@ -983,3 +983,19 @@ specify bindings for printer control variables.") (nreverse (mapcar #'car *compiler-print-variable-alist*)) (nreverse (mapcar #'cdr *compiler-print-variable-alist*)) ,@forms))) + +;;; Like DESTRUCTURING-BIND, but generates a COMPILER-ERROR on failure +(defmacro compiler-destructuring-bind (lambda-list thing context + &body body) + (let ((whole-name (gensym "WHOLE"))) + (multiple-value-bind (body local-decls) + (parse-defmacro lambda-list whole-name body nil + context + :anonymousp t + :doc-string-allowed nil + :wrap-block nil + :error-fun 'compiler-error) + `(let ((,whole-name ,thing)) + (declare (type list ,whole-name)) + ,@local-decls + ,body))))