1 ;;;; This software is part of the SBCL system. See the README file for
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
)
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
25 ,@(when doc
`(,doc
)))))))