Issue ID: 16520
Summary: static foreach should be more explicit
Currently, one can hardly tell when reading a `foreach` statement if it's
executed at CT or not. One should know that the argument passed is actually a
Even when it's known, there is a risk that a later change can change this
I propose we implement a `static foreach` construct, which ensures that a
`foreach` is executed at compile time.
The roadmap could look like the following:
- Support for `static foreach`: Old `foreach` over tuple still have the same
effect, but one can use the `static` keyword to ensure this specific behaviour
is used. If not, the compiler produces an error;
- Later on, deprecate `foreach` on tuple without `foreach`.
- Then make it an error
- Later on, we can consider allowing it, but it will mean it gets executed at
This would not introduce any new feature in `static foreach` - That can be done
later if wanted. But would make this obscure construct a bit less obscure.