www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - static foreach in real life

Hello,

If you use `static foreach` be aware that 
https://issues.dlang.org/show_bug.cgi?id=18211 was fixed recently 
and one need a frontend DMDFE >= 2.081-beta1 in order to build 
such code with the -X flags (JSON output).

This bug is exposed very easily within VisualD which build things 
with -X.
I don't know if other IDE do it too.
Also with "dub --build=ddox"

If you make a third-party library with `static foreach`, you may 
want to consider whether you want to cut yourself from the set of 
people "IDE users that use an already released D compiler" (since 
you need a beta compiler to -X this).

A counter-measure for compatibility would be to defer such usage 
until next year, and use the former implicitely-static `foreach` 
where applicable.
Jun 19 2018