Dealing with type information loss in Parameters Fields and Return type

Nicholas Wilson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Apr 17 03:12:29 PDT 2016


So currently there is a loss of information when Parameters 
Fields and Return type.
i.e. assuming 64 bits
size_t foo(ptrdiff_t) {};

writeln(ReturnType!foo); // prints ulong

Is there any way to get the types as (tuples of) strings of the 
the types as they are in the source file?

auto foos = StringReturnType!foo;
static assert(typeof(foos) == string);
pramga(msg, foos); // available at CT, prints size_t


More information about the Digitalmars-d-learn mailing list