[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]

Re: Stepper protocol



re: the step protocol.

How about this nice message?

while (tableStepper->hasValue()) {
  porphyria(tableStepper->stepValue())
}

Where stepValue() steps and returns the value of the iterand (either
pre or post-increment - must have default).

The only reason is to slightly tighten up loops, because you will almost
always have to have both step() and value().  The downside is that it is
NOT obvious whether stepValue() is pre or post increment, so it could 
confuse a lot of developers (like me).

Another thought is to have some messages for using multiple steppers, esp,
termination condition checking.
so maybe hasValueAnd(otherStepper->hasValue()) or something.  This could
help reduce long sequences of blah->hasValue && blue->hasValue() ...

--Hugh