Andrei Alexandrescu:

Walter and I would preapprove implementation of static foreach if and only if a solid DIP comes about.

Some suggestions for a static foreach DIP:
- It should work at global scope too (I'd like with() to work at global scope too). - The semantics of "static foreach (x; TypeTuple!(1, 2))" should not change, if possible (in alternative it could change a little, but eventually become a syntax error). - At first "foreach (x; TypeTuple!(1, 2))" should give a warning, then a deprecation message, and then an error message that "static" is required. This makes iteration on type tuples visibly static. - "static foreach_reverse (immutable i; 0 .. 10)" could be supported.
- "static foreach (immutable i; iota(1, 10, 2))" should work.
- Please no tuple unpacking, because this foreach feature should die and be replaced by something more general and more correct.

Bye,
bearophile

Reply via email to