bearophile wrote:
You have missed half (well, two thirds) of what I was trying to say. It's not just about enforcing purity (or just @readonly of names in outer scopes), but it's also a problem of automatic analysis of notation (code). If you have generic D code it's harder to perform inferences on it. That's the purpose of those forall, etc, I have tried to talk about (and maybe you have also missed the part about the relation between code size and bug-prone nature of contracts).
It is not easier to statically analyze a forall rather than a foreach. I also see no evidence that foreach is more bug-prone than a forall would be.