View mode: basic / threaded / horizontal-split · Log in · Help
January 05, 2010
Compare in ParaSail
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
January 05, 2010
Re: Compare in ParaSail
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
Top | Discussion index | About this forum | D home