Dealing with type information loss in Parameters Fields and Return type

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Apr 17 04:47:52 PDT 2016


On Sunday, April 17, 2016 11:00:15 Nicholas Wilson via Digitalmars-d-learn 
wrote:
> On Sunday, 17 April 2016 at 10:48:08 UTC, Jonathan M Davis wrote:
> > On Sunday, April 17, 2016 10:12:29 Nicholas Wilson via
> >
> > Digitalmars-d-learn wrote:
> >> [...]
> >
> > 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
> >
> > [...]
>
> Sorry for the confusion, I didn't. getting the string "size_t" as
> the result of a hypothetical StringReturnType is the desired
> outcome.

Then I very much doubt that it's possible. The compiler doesn't distinguish
between an alias and the original. As far as it's concerned, they're exactly
the same thing. The compiler is pretty much doing the equivalent of
textually replacing all instances of an alias with the original.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list