On 9/8/13, monarch_dodra <monarchdo...@gmail.com> wrote: > enum S > { > a, > alias b = a, > } > > This would create an enum with a *single* entry, which can be > accessed via two different names.
Yeah I've thought about this separately from that enhancement, I think this feature *alone* would help to avoid issues with duplicate enum members, e.g. where you're generating a switch case table via EnumMembers. You can use NoDuplicates to for this, but it still doesn't change that the following fails: enum E { a, b = a } void main() { static assert(is(E.a == E.b)); // fails } This may or may not be an issue.. Also, currently we don't have a way to get the length of enum members except via EnumMembers, but if we ever implemented "E.length" then maybe the alias behavior could be useful.