opCmp

Gor Gyolchanyan gor.f.gyolchanyan at gmail.com
Fri Feb 3 06:44:00 PST 2012


Good day.

There's a problem in how opCmp works.

I have a structure, that represents an element of a range. Let's say a
character. That character can be invalid.
I need all comparison operators to return false of at least one of the
operands is invalid.
with opCmp, the expression a @ b is rewritten as a.opCmp(B) @ 0, which
doesn't allow me to define such a logic.
wouldn't it be better to change the rewrite of opCmp to test for exact
values -1, 0 and 1? In that case I could return 2 and have all
comparisons fail.

-- 
Bye,
Gor Gyolchanyan.


More information about the Digitalmars-d mailing list