Walter Bright Wrote:
> 1. Asserts and contracts are for detecting program BUGS. They are not for
> validating user input, checking for disk full, file not found errors, etc.
>
> 2. Enforce is for validating user input, checking for disk full, file not
> found
> errors, etc. Enforce is NOT for use in contracts or checking for program bugs.
>
>
> Any use of enforce in Phobos that is checking for program bugs is itself a
> bug
> and should be entered into bugzilla for fixing.
So this is a bug? This is a contract, not a validation of user input.
struct Iota(N, S) if ((isIntegral!N || isPointer!N) && isIntegral!S)
{
private N current, pastLast;
private S step;
this(N current, N pastLast, S step)
{
enforce((current <= pastLast && step > 0) ||
(current >= pastLast && step < 0));
this.current = current;
this.step = step;