identity-tuple
Factor handbook » The language » Objects » Equality

Prev:equal? ( obj1 obj2 -- ? )
Next:clone ( obj -- cloned )


Vocabulary
kernel

Class description
A class defining an equal? method which always returns f.

Examples
To define a tuple class such that two instances are only equal if they are both the same instance, inherit from the identity-tuple class. This class defines a method on equal? which always returns f. Since = handles the case where the two objects are eq?, this method will never be called with two eq? objects, so such a definition is valid:
TUPLE: foo < identity-tuple ;

By calling = on instances of foo we get the results we expect:
T{ foo } dup = .
t

T{ foo } dup clone = .
f


Definition


Methods