alias symbol name

Radu void at null.pt
Tue Jun 26 09:47:44 UTC 2018


On Tuesday, 26 June 2018 at 09:24:15 UTC, Stefan Koch wrote:
> On Tuesday, 26 June 2018 at 09:14:11 UTC, Radu wrote:
>> Consider this https://run.dlang.io/is/HyY2qG
>>
>> ---
>> void main()
>> {
>>     import std.traits;
>>     size_t s;
>>
>>     pragma(msg, typeof(s).stringof);
>>     pragma(msg, mangledName!(typeof(s)));
>>     pragma(msg, mangledName!s);
>> }
>> ---
>>
>> It outputs:
>> ---
>> ulong
>> m
>> _D9onlineapp4mainFZ1sm
>> ---
>>
>> I'm looking for a way to get the `s` type symbol name (size_t) 
>> not whatever the alias is pointing to (ulong in this case).
>>
>> Is there a way to obtain the alias symbol name?
>
> __traits(identifier, sym);

Him, that will print the symbol name, in my case `s`.

To cut to chase - I'm looking something that will print `size_t` 
for the symbol `s`.


More information about the Digitalmars-d-learn mailing list