@def: ha I knew I had already seen some code that did this, but I couldn't remember where.
@cdome: That's a good idea. I have some half working version using RTTI hack
but it isn't all that fast.
proc parseEnum[T: enum](s: string): T =
let typ = cast[PNimType](getTypeInfo(T(0)))
let n = typ.node
var values = n.sons
for i in 0..<n.len:
#cmpIgnoreStyle(cstring, cstring)
if cmpIgnoreStyle(s, values[i].name) == 0:
return T(values[i].offset)
