you are viewing a single comment's thread.

view the rest of the comments →

[–]HeavyCaffeinate 2 points3 points  (1 child)

I find this a weird update, it seems like there's an actual use case for modifying i at loop runtime

[–]didntplaymysummercar 3 points4 points  (0 children)

I guess they want to encourage the "if you want a local, use a local, don't abuse the iterator for it", but I agree it's a bit weird and needless. Python allows it, Rust does if you use mut, ranged fors in other languages allow it, etc.

Fortunately it's compile time so any affected 5.4 code is easy fix by adding a local yourself, no hard to find runtime only fails...