A fresh look at comparisons

Janice Caron caron800 at googlemail.com
Mon Apr 14 11:47:01 PDT 2008


On 14/04/2008, Scott S. McCoy <tag at cpan.org> wrote:
> Wouldn't that safely be 0?
>
>  If there is no order, there must be quality...assuming that all types do
>  have a natural order, even if it's just it's ordinal value. Otherwise,
>  they may not be comparable with opCmp, and maybe say, only opEquals :-)

For example, consider the complex numbers. (1+i) and (1-i) compare as
!<>=, however (1+0i) and (2+0i) compare as <, so sometimes they're
comparable and sometimes not.



More information about the Digitalmars-d mailing list