TypeFunction example creatiing a conversion matrix

Stefan Koch uplink.coder at gmail.com
Thu Oct 1 13:57:07 UTC 2020


On Thursday, 1 October 2020 at 13:53:53 UTC, H. S. Teoh wrote:
> On Thu, Oct 01, 2020 at 12:27:23PM +0000, Stefan Koch via 
> Digitalmars-d wrote: [...]
>> type functions do a Type -> TypeObject conversion when you 
>> pass the
>> types in.
>> inside the type function you get a "type-like" interface.
>> But it has lost everything that made it a type.
>> It has sizeof, alignof, stringof, tupleof, you can use 
>> __traits on it.
>> But it cannot be used as a type anymore.
>> Not inside a type-function anyway.
>> 
>> If you return a type or a type tuple from a type function, it 
>> becomes a regular type/type tuple again.
>
> Isn't this just the same thing as Andrei's reification / 
> dereification, except redressed in terms of aliases?
>
>
> T

Well you just pose the question the other way around.

Isn't Andrei's thing just a copy of mine, except redressed in 
terms of templates?

Yes. But the object being implicit I can use compiler internals 
to extract the data I need on the fly.
No need to prebuild conversion tables and the like.
No need to define a struct in druntime.


More information about the Digitalmars-d mailing list