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")
15 (defmacro sb!xc:deftype (name arglist &body body)
17 "Define a new type, with syntax like DEFMACRO."
18 (unless (symbolp name)
19 (error "type name not a symbol: ~S" name))
20 (let ((whole (gensym "WHOLE-")))
21 (multiple-value-bind (body local-decs doc)
22 (parse-defmacro arglist whole body name 'deftype :default-default ''*)
23 `(eval-when (:compile-toplevel :load-toplevel :execute)
24 (%compiler-deftype ',name
28 ,@(when doc `(,doc)))))))