1.0.9.22: Dynamic-extent value-cells for MIPS.
[sbcl/tcr.git] / src / compiler / deftype.lisp
blob8c266b343232af0d5f1f1308f00a6fd62c713312
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 (def!macro sb!xc:deftype (name arglist &body body)
13 #!+sb-doc
14 "Define a new type, with syntax like DEFMACRO."
15 (unless (symbolp name)
16 (error "type name not a symbol: ~S" name))
17 (with-unique-names (whole)
18 (multiple-value-bind (body local-decs doc)
19 (parse-defmacro arglist whole body name 'deftype :default-default ''*)
20 `(eval-when (:compile-toplevel :load-toplevel :execute)
21 (%compiler-deftype ',name
22 (lambda (,whole)
23 ,@local-decs
24 ,body)
25 ,@(when doc `(,doc)))))))