On Friday, 17 March 2017 at 15:14:08 UTC, Hussien wrote:
What I am talking about is

If you want to add a new feature, `static foreach`, that has static continue and static break, I can get behind that, but that's a new feature, not a bug in the existing feature. You think it is something it isn't.

`static if` is unique in D. Nothing else works like it. There is no static switch, no static foreach. Regular switch and foreach can work on compile time values, but they don't actually change their behavior like static if does, they work the same as always. The best you get is that the current value of the foreach can inherit the compile-time staticness of what it is looping, allowing you to use it in a few more places (notably in static if), but the loop construct itself is the same.

That's it. It does not do special flow control, it does not change scopes or compile requirements.

A new `static foreach` that DOES do those things, and works in places `static if` currently works like outside functions, would be a cool new feature. But until that's added, stop thinking of "static foreach" as being a special thing in the language now. It isn't there. It is just regular foreach and thinking of it as that, always, will make things a lot easier.


Then you can join the calls for a new `static foreach` that explicitly IS compile time! And we'll be on the same page there.

Reply via email to