On Friday, August 09, 2013 01:16:12 captaindet wrote: > module demo; > import std.stdio, std.typetuple, std.typecons; > > enum ok = tuple("one", "two", "three"); > pragma(msg, ok, ", ", ok[0]); > // Tuple("one", "two", "three"), one > enum er = TypeTuple!("one", "two", "three"); > // pragma(msg, er); > // Error: variable _er_field_0,1,2 cannot be read at compile time
I'm pretty sure that this is just a bad error message. > void main(){ > writeln("ok: ", ok, " ok[0]: ", ok[0]); > // ok: Tuple!(string, string, string)("one", "two", "three") ok[0]: one > writeln("er: ", er, " er[0]: ", er[0]); > // er: onetwothree er[0]: one > } What I expect is happening is that TypeTuples don't convert to string, so the pragma fails, but in the writeln, because writeln is variadic, it unrolls the TypeTuple, giving you writeln("er: ", er[0], er[1], er[2]], "er[0]: ", er[0]); and that works just fine, as each individual element in er converts to string just fine (particularly since they actually _are_ strings in this case). - Jonathan M Davis