2012-09-01 2 views

답변

5

난 그냥 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] 

, 당신은 항상로 구현 의존적 인 코드를 작성할 수 있습니다 이러한 기능이 표준에 언급되지 않은 경우에도이를 달성하십시오.

(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] 
예를 들어, CCL에 (테스트되지 않은, 그냥 관련 코드를 미끄러 져)
관련 문제