]> gitweb.factorcode.org Git - factor.git/commitdiff
classes.struct: remove equal method
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 24 Jan 2022 23:28:38 +0000 (15:28 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 24 Jan 2022 23:28:38 +0000 (15:28 -0800)
basis/classes/struct/struct.factor

index 4e8125ea6113f126275749376199fc4076885072..4634577d9cfe717e413b28501bc7eab5b2c71450 100644 (file)
@@ -202,17 +202,6 @@ M: struct-c-type base-type ;
 : 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
 
@@ -285,11 +274,7 @@ M: struct binary-zero? binary-object uchar <c-direct-array> [ 0 = ] all? ; inlin
     ] [ 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 ;
@@ -364,7 +349,6 @@ M: struct-class reset-class
         [ 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 ;