www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Compare in ParaSail

reply bearophile <bearophileHUGS lycos.com> writes:
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
Jan 05 2010
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
bearophile wrote:
 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
That means no static checking of ordered vs. unordered types. Andrei
Jan 05 2010