     dup dup tuple-layout echelon>>
     [ tuple-instance? ] 2curry define-predicate ;
 
-: superclass-size ( class -- n )
-    superclasses but-last [ "slots" word-prop length ] sigma ;
+: class-size ( class -- n )
+    superclasses [ "slots" word-prop length ] sigma ;
 
 : (instance-check-quot) ( class -- quot )
     [

: define-tuple-prototype ( class -- )
    dup tuple-prototype "prototype" set-word-prop ;

: finalize-tuple-slots ( class slots -- slots )
    swap superclass-size 2 + finalize-slots ;

: define-tuple-slots ( class -- )
    dup dup "slots" word-prop finalize-tuple-slots
    define-accessors ;

: make-tuple-layout ( class -- layout )
    [ ]
    [ [ superclass-size ] [ "slots" word-prop length ] bi + ]
    [ superclasses dup length 1- ] tri
    <tuple-layout> ;


: check-superclass ( superclass -- )
    dup valid-superclass? [ bad-superclass ] unless drop ;

GENERIC# (define-tuple-class) 2 ( class superclass slots -- )

PRIVATE>

: define-tuple-class ( class superclass slots -- )
    over check-superclass
    make-slots over class-size 2 + finalize-slots
    (define-tuple-class) ;

M: word (define-tuple-class)
    define-new-tuple-class ;

M: tuple-class (define-tuple-class)
    3dup tuple-class-unchanged?
    [ 3drop ] [ redefine-tuple-class ] if ;

