On Sunday, 18 June 2017 at 11:11:59 UTC, Johan Engelen wrote:
On Sunday, 18 June 2017 at 09:56:50 UTC, Steven Schveighoffer
wrote:
On Sunday, 18 June 2017 at 09:28:57 UTC, Johan Engelen wrote:
Reviving this thread to see whether anything has changed on
the topic.
If Timon gets static for each into the language, it can look a
little better.
Can you help me understand what you mean? How will it improve
things? (static foreach would disable the "statement not
reachable" analysis?)
The new static foreach is AFAIK supposed to execute the loop
instead of unrolling it, i.e. the expansion of
---
foreach (i, U; T) {
static if (is(U == bool)) {
return false;
}
}
return true;
---
to
---
static if (is(U1 == bool)) {
return false;
}
static if (is(U2 == bool)) {
return false;
}
...
return true;
---
, which triggers that "statement is not reachable" if at least
one of U1,U2,... = T is bool, will not occur if you instead use
`static foreach (i, U; T)`.