Comparison: when operator<() is better than opCmp()

OF nospam at nospammington.com
Sat Sep 8 07:36:44 PDT 2007


Giuseppe Bilotta Wrote:

>[...]
> Observe that this is no different from the fact that not all reals
> are comparable either, if any of them is a real.nan --does this
> mean we should use a syntax different from a < b for reals? I
> don't think so.
>[...]

I consider NaN incorrect input, and that that's why it sets an exception. And there is different syntax available in D, if one doesn't want exceptions to be set.

Your other points are good. From my programming point of view I'd still slightly dislike it, but if your target users wouldn't think it confusing in any way, then I accept your example.




More information about the Digitalmars-d mailing list