I've recently ran into a hard to track bug in my code: ----- enum MouseAction { press, release, /** Convenience - equal to $(D press). */ click = press, double_click, // oops, it's now equal to release!! } void main() { static assert(MouseAction.release != MouseAction.double_click); // fail } ----- Unfortunately the introduction of the convenience member ended up re-setting the enum member init counter, which ended up making "double_click" equal the value of "release". To avoid such buggy code, but still allow these convenience members, I propose we introduce member aliases as a new feature: ----- enum MouseAction { press, release, alias click = press, // same as press, but does not reset the counter! double_click, // equals release + 1 } void main() { static assert(MouseAction.release != MouseAction.double_click); // ok } -----
https://github.com/D-Programming-Language/dmd/pull/2529