Static foreach pull request

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Mon May 8 20:06:37 PDT 2017


Code: https://github.com/dlang/dmd/pull/6760

Some examples: 
https://github.com/tgehr/dmd/blob/71ab1280c88f9f0922fabf89ab3e7e1164b70e8b/src/test_staticforeach.d

This is a complete proof-of-concept implementation of "static foreach". 
The semantics of the construct are given by merging the ones of static 
if and runtime foreach. This allows declarations to be generated using 
an imperative loop.

If you are interested in static foreach making it into the language, 
please play with the implementation and tell me how to break it. It 
would also be nice to get some code reviews (the implementation is the 
result of two days of exhausting trial-and-error figuring out how the 
DMD frontend works).



More information about the Digitalmars-d mailing list