I was bit yesterday by a bug/misfeature in foreach regarding iterators. After getting the index and/or value from the iterator, it increments it before executing the loop code. I.e. the following will throw an error:
String.Iterator iter = String.Iterator ("foo"); foreach (iter; int idx;) if (idx != iter->index()) error ("wtf?\n");
I consider it a bug and intend to change foreach so that the iterator is incremented after the loop instead.
Unfortunately that change can have nasty effects in code that expects foreach to behave like this. I can either change it in 7.5 only and fix some #pike 7.4 compatibility goo, or I can "ignore" the compat issue and fix it in both 7.4 and 7.5. I'm actually inclined to do the latter, under the assumption that there still is very little code that use iterators this way (Grubbas new compiler is the only example I know). If it stays as it is in 7.4 it can be cumbersome to update code to 7.5.
Not sure though if we can get away with pulling a stunt like that this long after the 7.4 release. Does anyone know of more code that depends on this foreach quirk?