On Sunday, April 17, 2016 10:12:29 Nicholas Wilson via Digitalmars-d-learn wrote: > 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
I'm actually surprised that you got the compiler to give you size_t in any form. size_t is simply an alias to either ulong (on 64-bit systems) or uint (on 32-bit systems), and for better or worse, aliases pretty much just disappear. As far as the compiler is concerned, if it sees alias size_t = ulong; t's basically just replacing all instances of size_t with ulong, and size_t doesn't even exist. The same goes with any other alias (like ptrdiff_t) whether you declare it or whether it's in druntime or Phobos. You will never see size_t in an error message except maybe when you mistype it, and the compiler is providing a suggestion for what you meant to type. As far as the compiler is concerned, there is no difference between an alias and what it's an alias of. - Jonathan M Davis