: forget-struct-slot-values-method ( class -- )
\ struct-slot-values ?lookup-method forget ;
-: struct-equals-quot ( class -- quot )
- dup struct-slots
- [ name>> reader-word 1quotation '[ [ @ ] same? ] ] map
- '[ over _ instance? [ _ 2&& ] [ 2drop f ] if ] ;
-
-: define-equal-method ( class -- )
- [ \ equal? ] [ struct-equals-quot ] bi define-inline-method ;
-
-: forget-equal-method ( class -- )
- \ equal? ?lookup-method forget ;
-
: clone-underlying ( struct -- byte-array )
binary-object memory>byte-array ; inline
] [ drop f ] if ;
: define-struct-methods ( class -- )
- {
- [ define-struct-slot-values-method ]
- [ define-clone-method ]
- [ define-equal-method ]
- } cleave ;
+ [ define-struct-slot-values-method ] [ define-clone-method ] bi ;
: check-struct-slots ( slots -- )
[ type>> lookup-c-type drop ] each ;
[ forget-struct-slot-accessors ]
[ forget-struct-slot-values-method ]
[ forget-clone-method ]
- [ forget-equal-method ]
[ { "c-type" "layout" "struct-size" } remove-word-props ]
[ call-next-method ]
} cleave ;