core.reflect vs c++ reflection

Stefan Koch uplink.coder at googlemail.com
Mon Sep 27 07:28:46 UTC 2021


On Monday, 27 September 2021 at 06:25:07 UTC, bauss wrote:
> On Sunday, 26 September 2021 at 19:09:31 UTC, Stefan Koch wrote:
>> On Sunday, 26 September 2021 at 19:03:24 UTC, Stefan Koch 
>> wrote:
>>> Good day,
>>
>>>
>>>
>>> Please let know what you think.
>>
>> Ugh typo.
>>
>>>static immutable ed = cast(EnumDeclaration)nodeFromName(E);
>>
>> is supposed to be:
>>
>> `static immutable ed = cast(EnumDeclaration)nodeFromName("E");`
>
> What about E.stringof? Instead of hardcoding names :) Not sure 
> if stringof will return E in all cases, so obviously only if it 
> works.

E stringof would return the name of the type;
In simple cases and garbage in others.

Whereas the name E always refers to the type used in the toString 
template.
Also "E" is less typing than E.stringof


More information about the Digitalmars-d mailing list