Previous section: Non-local Exits

Dylan reference manual -- 5. Comparisons

5. Comparisons

Dylan provides an identity function, as well as a group of equality and magnitude comparison functions that can be extended for user classes. The methods ~=, >, <=, and >= are defined in terms of = and <. By extending the behavior of = and <, programs can extend the behavior of the other methods.

For the protocol to work, all methods on = and < must preserve the following properties:

If (a == b), then (a = b).
If (a < b) and (b < c), then (a < c).
If (a = b) and (b = c), then (a = c).
Exactly one of: (a < b), (a = b), (b < a) always holds
(on the assumption that these two operations are defined for the objects in question).[ 12,13]

Next section: Equality Comparisons