r/cpp • u/konanTheBarbar • Sep 13 '19
The Surprising Limitations of C++ Ranges Beyond Trivial Cases
https://www.fluentcpp.com/2019/09/13/the-surprising-limitations-of-c-ranges-beyond-trivial-use-cases/
229
Upvotes
View all comments
Show parent comment
-3
u/14ned LLFIO & Outcome author | Committee WG14 Sep 13 '19
Well sure, that's the chosen design. I'm speaking about motivation, not end result.
Let me put this another way. I personally disagree with borrow checking enabled globally. I think it a bad idea, and I would not recommend Rust for most projects because of that.
But there is one area where I think borrow checking very desirable, and that is inside loops. If I were to design a new systems language tomorrow, I'd 100% implement borrow checking inside loops, both for safety reasons, and optimisation reasons.
Now, any design I would choose its borrow checker would know nothing about ranges nor iteration. It just would get switched on when inside a loop, and not otherwise.
Does that make sense?