https://issues.dlang.org/show_bug.cgi?id=14984
Denis Shelomovskij <verylonglogin....@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |verylonglogin....@gmail.com --- Comment #4 from Denis Shelomovskij <verylonglogin....@gmail.com> --- (In reply to Marc Schütz from comment #3) > @Kenji Hara: > > Yes, I know that. My point is that it's too easy to forget to add `const`. It's not a special `foreach` issue. It's a mistake to modify a variable in most cases as often it is just a constant view of data so if one doesn't follow "everything must be marked `const` except it is definitely mutable" it's his coding style problem. Unfortunately D doesn't solve this issue as it doesn't assume `const` by default. I hope the next D version will do it. --