opCmp, [partial/total/pre]orders, custom floating point types etc.

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 12 12:25:25 PST 2016


On 01/12/2016 03:10 PM, Fool wrote:
> On Tuesday, 12 January 2016 at 20:04:26 UTC, Andrei Alexandrescu wrote:
>> I'd be in favor of giving people the option to disable the use of <=
>> and >= for specific data. It's a simple and logical approach. -- Andrei
>
> But doesn't the symbol <= originate from ORing < and = ?

D uses !(b < a) for a <= b. We can invent notation to disallow that rewrite.

Anyhow the use of <, >, <=, and >= for partially ordered types is bound 
to be less than smooth. Math papers and books often use other notations 
(such as rounded or square less-than) to denote operators for partially 
ordered data, exactly because denoting them with the classic notation 
may confuse the reader.


Andrei



More information about the Digitalmars-d mailing list