On Sunday, 24 August 2025 at 03:29:30 UTC, Paul Backus wrote:
On Sunday, 24 August 2025 at 03:13:38 UTC, David T. Oxygen wrote:
Hello every kind and helpful D programmers, I need your help.

I've met two problems about getting types.
In D, we can use many keywords to get the type of an object, such as `typeof`,`typeid`,`is`. However, I don't know the differences between them well. I also don't know how to use them in D...

`typeof` is evaluated at compile time and gives the type of an expression or symbol as seen by the compiler.

`typeid` is evaluated at runtime and gives the [`TypeInfo`][1] object containing information about an object's runtime type.

[1]: https://dlang.org/library/object/type_info.html


--
Thanks.
But I still don't know how to use `is` `__traits`.
And, how can I fill in `/*?????*/`? Can I use `typeid(result)==MyInt`? Or if the `is` keyword can do this?



Reply via email to