.tupleof.stringof

Christopher Wright dhasenan at gmail.com
Wed Jan 21 20:34:42 PST 2009


Christopher Wright wrote:
> Check this out!
> class Foo { int someField; }
> pragma (msg, Foo.tupleof[0].stringof); // int
> pragma (msg, Foo.tupleof[0].mangleof); // someField
> 
> Why is this? It's counterintuitive.

Okay, no, this example is a shorter version of something else that 
exemplified this behavior:
foreach (i, field; Foo.init.tupleof)
    pragma (msg, field.stringof);

This has the results I described. However, the following has the 
expected result:
pragma (msg, Foo.init.tupleof[0].stringof);


More information about the Digitalmars-d-learn mailing list