Peter Gerwinski wrote:
If everybody agrees that there should be an extension like this in GPC: It's probably not so hard to implement. Suggestions for the syntax? Objections against it?
Why not? If it's not too much work to do. Could it be a problem if Ord(EnumVal)<0 ? I don't see any.
Suggestion:
type TComparisonResult=(Less value -1, Equals, Greater, Strange value 10);
i.e. Ord(Less)=-1, Ord(Equals)=0, Ord(Greater)=1, Ord(Strange)=10.
Disadvantage: Range checking will get more difficult.
type TComparisonResult=(Less value -1, Equals, Greater, Strange value 10);
i.e. Ord(Less)=-1, Ord(Equals)=0, Ord(Greater)=1, Ord(Strange)=10.
Another problem ... it will make pred() and succ() harder if they must do succ(Greater) => Strange and pred(Strange) => Greater. I think setting the initial value would be reasonable, but not allowing a jump in the values.