Common Lispは、deftypeで作成された型を定義解除する機能を提供します か?
Hyperspecにはそれについて何も見つかりませんでした。
unintern
派生型指定子のみを使用します。
T1> (deftype foo () 'fixnum)
FOO
T1> (let ((bar 1))
(check-type bar foo))
NIL
T1> (unintern 'foo)
T
T1> (let ((bar 1))
(check-type bar foo))
Unknown type specifier: FOO
[Condition of type SIMPLE-ERROR]
また、何らかの理由で型のすべてのトレースを削除することを本当に懸念している場合は、そのような機能が標準で言及されていなくても、それを達成するためにいつでも実装依存のコードを書くことができます。たとえば、CCL では (テストされていないため、関連するコードをざっと調べただけです):
(defun delete-type (derived-type-specifier)
(ccl::clear-type-cache)
(remhash derived-type-specifier ccl::%deftype-expanders%)
(setf (documentation derived-type-specifier 'type) nil))
さあ、いくぞ:
T1> (deftype foo () "frob" 'fixnum)
FOO
T1> (documentation 'foo 'type)
"frob"
T1> (let ((bar 1))
(check-type bar foo))
NIL
T1> (delete-type 'foo)
NIL
T1> (documentation 'foo 'type)
NIL
T1> (let ((bar 1))
(check-type bar foo))
Unknown type specifier: FOO
[Condition of type SIMPLE-ERROR]