On Thursday, 21 November 2013 at 07:42:48 UTC, Craig Dillabaugh wrote:
I should also mention, this post likely better belongs in:

digitalmars.D.learn

I don't entirely think so. I think the OP is arguing that D should be able to identify symbol as specific enum's field when used: - in place of function argument when the fn parameters is of enum type
  - and when comparing for equality with variable of enum type.

ie. the lookup of the symbol should be first inside the enum, and the continue normally.

There was plan long long time ago to implement it, but I don't remember for which reason it was not.

In order to consider this again for implementation I think proper DIP should be written where complete semantics of this should be described. For one I don't know how it should be have if you would have variable of the same name as enum field i.e:

enum State { on, off }
auto State s;
auto on = 1;
if (on == on) ?

And I think it would be especially confusing when enum which is function parameters has the same field name as local variable on call site:

void change (State s) {}
void main () { State on = State.off, change (on) }

Reply via email to