1.0.9.48: texi2pdf rework (Aymeric Vincent sbcl-devel 2007-09-05)
[sbcl/lichteblau.git] / src / code / destructuring-bind.lisp
blobc485b75e77d922bb0b246935e9d4168990e7323e
1 ;;;; This software is part of the SBCL system. See the README file for
2 ;;;; more information.
3 ;;;;
4 ;;;; This software is derived from the CMU CL system, which was
5 ;;;; written at Carnegie Mellon University and released into the
6 ;;;; public domain. The software is in the public domain and is
7 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
8 ;;;; files for more information.
10 (in-package "SB!IMPL")
12 (defmacro-mundanely destructuring-bind (lambda-list expression &body body)
13 #!+sb-doc
14 "Bind the variables in LAMBDA-LIST to the corresponding values in the
15 tree structure resulting from the evaluation of EXPRESSION."
16 (let ((whole-name (gensym "WHOLE")))
17 (multiple-value-bind (body local-decls)
18 (parse-defmacro lambda-list whole-name body nil 'destructuring-bind
19 :anonymousp t
20 :doc-string-allowed nil
21 :wrap-block nil)
22 `(let ((,whole-name ,expression))
23 ;; This declaration-as-assertion should protect us from
24 ;; (DESTRUCTURING-BIND (X . Y) 'NOT-A-LIST ...).
25 (declare (type list ,whole-name))
26 ,@local-decls
27 ,body))))