Is there a reason why you cannot create a separate scope within a static foreach?

The below will not compile:

```
enum a = ["a" : "a", "b" : "b", "c" : "c"];

static foreach (k,v; a)
{
    {
        enum b = k;
        enum c = v;
    }
}
```

It works if it's in a function of course.

This creates a big limitation when you're trying to ex. loop through members of inherited classes, interfaces etc. and then want to store the information in variables, because you cannot do it. Which means to work around it you have to do it all in an ugly one-liner.

Is it intended behavior? If so, why? If not is there a workaround until it can be fixed?

Reply via email to