Yes, that is not good.
It is in accordance with the intension in the type system to choose the first (top most) version of cIterate that solves the "equation". and that is the second one:
Code: Select all
predicates
cIterate : (integer Count) -> integer I nondeterm.
cIterate : (unsigned Count) -> integer I nondeterm.
cIterate : (integer Count) -> unsigned I nondeterm.
cIterate : (unsigned Count) -> unsigned I nondeterm.
That should have resulted in an
out-of-range exception when subtracting 1 in:
Code: Select all
clauses
cIterate(Count) = fromTo(0, Count - 1) :-
Count > 0.
But the
std package have been equiped with a "/check:off" pragma:
And therefore the exception is not raised.
It may however make most sense to put that declatration last as it seems to be the "dangerous" one:
Code: Select all
predicates
cIterate : (integer Count) -> integer I nondeterm.
cIterate : (integer Count) -> unsigned I nondeterm.
cIterate : (unsigned Count) -> unsigned I nondeterm.
cIterate : (unsigned Count) -> integer I nondeterm.