On Monday, 30 November 2015 at 07:54:49 UTC, Rikki Cattermole
wrote:
enums don't have to be integral, but for performance reasons it
is for the best.
enum Foo : string {
A = "a",
B = "b",
C = "d",
ERROR = "What are you talking about?"
}
void main() {
import std.stdio : writeln;
Foo foo = Foo.ERROR;
writeln(foo, " is: ", cast(string)foo);
}
Also you are welcome in #d on Freenode (IRC) if you are
interesting in talking with the rest of us!
Btw you probably want tuples (std.typecons : tuple) to emulate
those values.
Oh interesting. So you are saying I could have a struct WhiteKey
{...} and then an enum that extends WhiteKey? You also mention
Tuples, are you recommending the Tuple's type be (WhiteKey, int)?
Thanks!