I would say it is a bug in the contract.
The signature is not normalized and the user gets a chance to provide
conflicting parameters. I think that it would be best to deduce the
direction
from the order of the start and end parameters. Then the stepsize can be
made
absolute.
Am 18.03.2011 09:14, schrieb Kagamin:
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;