Emulating enums
JS
js.mdnq at gmail.com
Wed Jul 31 18:10:40 PDT 2013
http://dpaste.dzfl.pl/dbb40dbc
The code was pared down from a lot of string mixin code
generation. I nest the structs because I want a nested enums. I
don't want have to have eState and eStateType but eState and
eState.Type.
Having the ability to nest enums would solve my problem.
Regardless, I can almost achieve the effect with nested structs
but not quite.
In the code, I cannot assign to the struct for some reason even
with alias this on iB, which should make State act like the int
Value.
i.e.,
b.State.Value = Enums.State.A;
works but
b.State = Enums.State.A;
doesn't
It maybe some stupid error on my part but I can't keep my eyes
open enough to figure it out...
More information about the Digitalmars-d-learn
mailing list