On Thursday, 27 April 2023 at 06:10:57 UTC, Basile B. wrote:

It's a misconception of the problem that the DIP tried to solve. What the DIP tried to solve is that the compiler should know that you are using an enum member. Actually I even think this should work without any special syntax, as a "last resort", let's say. But as you've explained, through Mike's report, this causes problems for D because the identifier resolution is tied to a particular implementation, i.e your fast symtabs.

I don't think it's a misconception. It's more like a complete lack of clarity. What would be the point of complexifying the language for the new programmer when you can just use an anonymous enum? This program runs just fine:

```
import std.stdio;

enum {
        A1,
        B1,
        C1,
        D1
}

enum {
        _A,
        _B,
        _C,
        _D
}

void main() {
        writeln(A1);
        writeln(_A);
        writeln(A1 == _A);
        
        auto flag = _B;
        switch(flag) {
                case _A:
                        writeln("_A");
                        break;
                case _B:
                        writeln("_B");
                        break;
                case _C:
                        writeln("_C");
                        break;
                case _D:
                        writeln("_D");
                        break;
                default:
                        break;
        }
}
```

What's the point in using a named enum if you want an anonymous enum? The response when this question was asked was not "because [something where it matters]". It was instead to ignore the question, give an unrealistic example that was solved by the response, and insert a bunch of unhelpful hostility.

Reply via email to