2012-09-01 16 views

risposta

5

vorrei solo unintern l'indicatore di tipo derivato:

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] 

Inoltre, se siete veramente preoccupati per l'eliminazione di ogni traccia del tipo per qualche motivo, si può sempre scrivere codice di implementazione-dipendente realizzarlo, anche se tale funzionalità non è menzionata nello standard. Per esempio, nel CCL (non testata, ho solo sfiorato il relativo codice):

(defun delete-type (derived-type-specifier) 
    (ccl::clear-type-cache) 
    (remhash derived-type-specifier ccl::%deftype-expanders%) 
    (setf (documentation derived-type-specifier 'type) nil)) 

E qui andiamo:

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]