Enhancing foreach
ixid
nuaccount at gmail.com
Wed Jan 9 10:08:51 PST 2013
I think you're rather a long way away from beginners to see how
beginners would think. iota is behaving like the Python range
syntax which beginners seem to find quite easy to use. A beginner
thinks 'it goes up to that number', the thought process you
outlined is that of someone learning their second or third
language.
> for (i; ++j) {
> /* ... */
> }
>
> Did I forget something or is it "from zero to the incremented
> value of j"?
Is that any different to the current for loops not doing what you
meant if you don't type things? It doesn't seem subtle nor an
unexpected behaviour, there's no shortage of cases where if you
omit bits of code it'll do something else. If this was supposed
to be a normal for loop the user's forgotten to give i a type and
a boundary condition and the second semi-colon, that's three
errors, the space of different behaviours you can get to in any
given piece of code by making three errors is probably quite high.
More information about the Digitalmars-d-learn
mailing list