Usage
MyPrimitive: MyPrimitiveType == add {
Rep == MachineInteger;
(x: %) = (y: %): Boolean == rep x = rep y;
}
Description
The category of types that provide equality testing.
Exports of MyPrimitiveType
Export of MyPrimitiveType
=: (%, %) -> Boolean
Usage
if x = y then ...
Parameters
Elements to be tested.
Description
Tests equality.
If x = y is true, then x and y are equal elements of the type. It does not (necessarily) mean that the elements are identical in the sense that they represent the same location in memory.
If x = y returns false means that equality cannot (computationally) be confirmed, i. e., whether x is really different from y depends on the type. For types that do not allow for full equality tests (as, for example, sequences) it should be interpreted as: x and y do not represent the same memory location and equality cannot be confirmed computationally.
The semantics of x ~= y is the boolean negation of x = y.
Export of MyPrimitiveType
~=: (%, %) -> Boolean
Usage
if x ~= y then ...
Parameters
Elements to be tested.
Description
Tests inequality.
The semantics of x ~= y is the boolean negation of x = y.
A domain that implements the category MyPrimitiveType need not explicitly implement inequality testing since the category already provides the following default implementation that should only be overridden if there is a faster way in a specific domain to test for inequality.