Re: Runtime evaluation

2011-07-09 Thread nrgyzer
== Auszug aus Mafi (m...@example.org)'s Artikel Am 07.07.2011 23:23, schrieb nrgyzer: Hi guys, I'm trying to read a string from a text file which contains a value of an enumeration like: enum MyEnum : string { Entry_1 = abc, Entry_2 = def, Entry_3 = ghi, } Stream

Re: Runtime evaluation

2011-07-08 Thread Mafi
Am 07.07.2011 23:23, schrieb nrgyzer: Hi guys, I'm trying to read a string from a text file which contains a value of an enumeration like: enum MyEnum : string { Entry_1 = abc, Entry_2 = def, Entry_3 = ghi, } Stream s = new File(myFile.ext, FileMode.In); uint len; s.read(len);

Runtime evaluation

2011-07-07 Thread nrgyzer
Hi guys, I'm trying to read a string from a text file which contains a value of an enumeration like: enum MyEnum : string { Entry_1 = abc, Entry_2 = def, Entry_3 = ghi, } Stream s = new File(myFile.ext, FileMode.In); uint len; s.read(len); string entry = cast(string)

Re: Runtime evaluation

2011-07-07 Thread David Nadlinger
You could generate the if/else-chain, lookup table, etc. via metaprogramming to save you the typing and code duplication (probably a foreach over std.traits.EnumMembers will be involved). David On 7/7/11 11:23 PM, nrgyzer wrote: Hi guys, I'm trying to read a string from a text file which