Dump special floating point operators
KennyTM~
kennytm at gmail.com
Thu Dec 3 21:39:49 PST 2009
On Dec 4, 09 13:16, bearophile wrote:
> Walter Bright:
>> While I like them a lot, it's time for them to go:
>>
>> 1. It's hard to remember which one does what
>> 2. They've failed to catch on
>> 3. No operator overloading for them
>> 4. They are only rarely needed; a special operator is not justified
>
> Before trashing everything some useful compromise between the two extrema (having many complex operators, and having nothing) can be found. I think Don said something about this.
>
> Regarding "no operator overloading for them", it's a matter of will, with the opBinary operator syntax it's easy to use them too :-)
>
> Bye,
> bearophile
Actually you could easily "overload" them with opCmp, you just need to
return a float.
class NonComparable {
float opCmp(NonComparable other) { return float.nan; }
};
void main () {
auto a = new NonComparable;
assert(a !<>= a);
}
More information about the Digitalmars-d
mailing list