         [ define-tuple-slots ]
         [ define-tuple-predicate ]
         [ define-tuple-prototype ]
-        [ define-tuple-constructor ]
-        [ define-tuple-initial-quots ]
     } cleave ;
 
 : define-new-tuple-class ( class superclass slots -- )

M: tuple hashcode* tuple-hashcode ;

M: tuple-class new
    dup "constructor" word-prop {
        { "initial-quots" [ "prototype" word-prop (clone) set-initial-quots ] }
        { "prototype" [ "prototype" word-prop (clone) ] }
        [ drop tuple-layout <tuple> ]
    } case ;

M: tuple-class boa
    [ "boa-check" word-prop [ call ] when* ]

: define-boa-check ( class -- )
    dup boa-check-quot "boa-check" set-word-prop ;

: tuple-initial-quots-quot ( class -- quot )
    all-slots [ initial-quot>> ] filter
    [
        [
            [ initial-quot>> , (( -- obj )) , \ call-effect , \ over , ]
            [ offset>> , ] bi \ set-slot ,
        ] each
    ] [ ] make f like ;

: tuple-prototype ( class -- prototype )
    [ initial-values ] [ over [ ] any? ] [ initial-quots? or ] tri
    [ slots>tuple ] [ 2drop f ] if ;

: define-tuple-prototype ( class -- )
    dup [ tuple-prototype ] [ tuple-initial-quots-quot ] bi 2array
    dup [ ] any? [ drop f ] unless "prototype" set-word-prop ;

: prepare-slots ( slots superclass -- slots' )
    [ make-slots ] [ class-size 2 + ] bi* finalize-slots ;
