Talk:Auto-Increment Proposal

Revision as of 21:55, 8 March 2007 by Colin-adams (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

I don't know whether folks really like the side-effecting auto-incrementers or whether they are just taught to program that way in C and its derivatives.

As for incrementors in INTEGER(_*) and CHARACTER(_*), I would say routines

successor: like Current

and predecessor: like Current

to return the next and previous one would be useful accessors (they should not wrap around, and so need pre-conditions for the limts).

and mutators:

increment

and

decrement

for the INTEGER(_*) types.

Why you think iterators should be difficult for beginners puzzles me. They are dead easy. It is loops that are difficult for beginners (especially loop invariants - they are difficult for me too), and should be avoided whenever possible.

Don't teach loops to beginners - teach iterators.