Compare in ParaSail
bearophile
bearophileHUGS at lycos.com
Tue Jan 5 00:36:21 PST 2010
From:
http://parasail-programming-language.blogspot.com/2009/10/using-in-parasail-to-implement-etc.html
>ParaSail skirts this issue by requiring the user to define only one operator, "=?", which returns a value from the enumeration Less, Equal, Greater, Unordered. The comparison and equality operators are defined in terms of "=?" [...] "Unordered" is used for types with only a partial ordering (or no ordering at all). "Ordered" is defined as the subtype containing only the values "Equal," "Less," and "Greater." The typical generic "Sort" operation would expect a "=?" operator whose result is guaranteed (via a postcondition) to be within the "Ordered" subtype. The "=?" operator can be used explicitly if desired, which is often convenient when searching a binary tree:<
Bye,
bearophile
More information about the Digitalmars-d
mailing list