Comment Re: Possible vs. Enforced (Score 1) 258
I think you're having your own conversation over there, my friend. Everyone else is talking about language features that are safer by design. You seem to be talking about people failing to understand elementary programming ideas.
The point isn't that anyone would deliberately construct a loop that iterates out of bounds. The point is that our industry has a very long and ignominious history of people writing loops with off-by-one errors and sometimes those errors have turned into serious failures of the systems that code belonged to. It is a fact that sometimes programmers do make those mistakes. It follows that alternative ways to express the intended behaviour that aren't vulnerable to those types of mistakes will be safer in this respect and will avoid some bugs that would otherwise have happened.
Also, the performance argument is shaky at best. For one thing, some of the better abstractions have essentially zero cost. They don't need extra runtime bounds checks or similar overheads because they are already correct by construction. For another thing, even in formulations that do behave as if there are runtime bounds checks before every iteration, modern code analysis techniques will recognise some patterns where the bounds can't be violated, so often compilers can elide those checks in the code they actually generate anyway.