 
 M: struct-class valid-superclass? drop f ;
 
-GENERIC: struct-slots ( struct-class -- slots )
-
-M: struct-class struct-slots "struct-slots" word-prop ;
+: struct-slots ( struct-class -- slots )
+    "c-type" word-prop fields>> ;
 
 ! struct allocation
 

    [ \ clone-underlying swap literalize \ memory>struct [ ] 3sequence ] bi
    define-inline-method ;

: c-type-for-class ( class -- c-type )
    struct-c-type new swap {
        [ drop byte-array >>class ]
        [ >>boxed-class ]
        [ struct-slots >>fields ]
        [ "struct-size" word-prop >>size ]
        [ "struct-align" word-prop >>align ]
        [ (unboxer-quot) >>unboxer-quot ]
        [ (boxer-quot) >>boxer-quot ]
    } cleave ;
    
: align-offset ( offset class -- offset' )
    c-type-align align ;

    [ type>> c-type-align ] [ max ] map-reduce ;
PRIVATE>

M: struct byte-length class "c-type" word-prop size>> ; foldable

! class definition

