What's the use of 'typeof','typeid','__traits','is' ?

user1234 user1234 at 12.de
Sun Aug 24 10:02:45 UTC 2025


On Sunday, 24 August 2025 at 08:25:56 UTC, H. S. Teoh wrote:
> On Sun, Aug 24, 2025 at 05:20:06AM +0000, David T. Oxygen via 
> Digitalmars-d-learn wrote: [...]
>> But I still don't know how to use `is` `__traits`.
> [...]
>
> Operations involving types, such as type comparisons, are 
> usually done only inside an `is`-expression.  For example:
>

I would have more described that as a "tool for static 
introspection".

I think that instead of `typeof()` D could have 
`__traits(type,arg)`.


More information about the Digitalmars-d-learn mailing list