X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fdestructuring-bind.lisp;h=c485b75e77d922bb0b246935e9d4168990e7323e;hb=95591ed483dbb8c0846c129953acac1554f28809;hp=1a74b3879a9f271b69949fbfbb16561fca490e9b;hpb=670010e3f3dcd62efaf23f61abdc73950edb88c6;p=sbcl.git diff --git a/src/code/destructuring-bind.lisp b/src/code/destructuring-bind.lisp index 1a74b38..c485b75 100644 --- a/src/code/destructuring-bind.lisp +++ b/src/code/destructuring-bind.lisp @@ -9,14 +9,19 @@ (in-package "SB!IMPL") -(defmacro-mundanely destructuring-bind (lambda-list arg-list &rest body) +(defmacro-mundanely destructuring-bind (lambda-list expression &body body) #!+sb-doc - "Bind the variables in LAMBDA-LIST to the contents of ARG-LIST." - (let ((arg-list-name (gensym "ARG-LIST-"))) + "Bind the variables in LAMBDA-LIST to the corresponding values in the +tree structure resulting from the evaluation of EXPRESSION." + (let ((whole-name (gensym "WHOLE"))) (multiple-value-bind (body local-decls) - (parse-defmacro lambda-list arg-list-name body nil 'destructuring-bind - :anonymousp t - :doc-string-allowed nil) - `(let ((,arg-list-name ,arg-list)) - ,@local-decls - ,body)))) + (parse-defmacro lambda-list whole-name body nil 'destructuring-bind + :anonymousp t + :doc-string-allowed nil + :wrap-block nil) + `(let ((,whole-name ,expression)) + ;; This declaration-as-assertion should protect us from + ;; (DESTRUCTURING-BIND (X . Y) 'NOT-A-LIST ...). + (declare (type list ,whole-name)) + ,@local-decls + ,body))))