core.reflect vs c++ reflection

Stefan Koch uplink.coder at googlemail.com
Mon Sep 27 15:17:39 UTC 2021


On Monday, 27 September 2021 at 13:12:32 UTC, WebFreak001 wrote:

> If it's mistyped, the compiler will complain that it doesn't 
> exist
>
core.reflect will tell you that you tried to resolve a name which 
does not exist as well.

> When it's an identifier, IDE refactorings (automated renaming) 
> will find it, while it wouldn't find it in a string, especially 
> the more generic the name is (which is common for template 
> types `T`)
>
> C# has `nameof(T)` which just returns `"T"` or for 
> `nameof(Foo.T)` it also just returns `"T"`

That's valid.
I have to think about what to do about that.
Maybe remove the "" for the refactoring?
a simple search for `nodeFromName\(\"$ID\"\)` maybe?
It's the only primitive in code reflect which does this.


More information about the Digitalmars-d mailing list