Custom control flow statements

Michiel nomail at hotmail.com
Tue Feb 13 08:13:01 PST 2007


I was thinking it might be useful if you could create custom control flow
statements like:

foreach_random (element, array) { ... }

Might just be an idea for the future of D. It could be declared like this:

void foreach_random(T)(T element, T[] array, void delegate() statements) { ... }

It would work kind of like those array functions, where the first array
parameter can also be placed in front of the function with a . inbetween. In
this case the last delegate parameter can also be placed after (without a .).

In theory you could also create things like:

threeway (x, 3) { ... } { ... } { ... }

What do you think?



More information about the Digitalmars-d mailing list