 
 C: <mixin-instance> mixin-instance
 
+<PRIVATE
+
 : >mixin-instance< ( mixin-instance -- class mixin )
     [ class>> ] [ mixin>> ] bi ; inline
+
+PRIVATE>
 
 M: mixin-instance where >mixin-instance< "instances" word-prop at ;
 

        [ nip update-methods ]
    } 3cleave ;

: remove-mixin-instance ( class mixin -- )
    [ (remove-mixin-instance) ] [ 2drop ] if-mixin-member? ;

M: mixin-class class-forgotten remove-mixin-instance ;

! Definition protocol implementation ensures that removing an
! INSTANCE: declaration from a source file updates the mixin.


M: mixin-class rank-class drop 3 ;

TUPLE: check-mixin-class class ;

: check-mixin-class ( mixin -- mixin )
    dup mixin-class? [
        \ check-mixin-class boa throw
    ] unless ;

<PRIVATE

: redefine-mixin-class ( class members -- )
    [ (define-union-class) ]
    [ drop t "mixin" set-word-prop ]
    2bi ;

: if-mixin-member? ( class mixin true false -- )
    [ check-mixin-class 2dup members member-eq? ] 2dip if ; inline
