Get variable symbol name that was passed to a paramater?

Rob T alanb at ucora.com
Sun Nov 10 16:58:52 PST 2013


On Saturday, 9 November 2013 at 11:07:08 UTC, Dicebot wrote:
> On Saturday, 9 November 2013 at 09:12:21 UTC, Rob T wrote:
>> It works except when passing a variable contained inside a 
>> struct or class due to a missing "this" during evaluation, I'm 
>> also worried about template bloat.
>>
>> I figure mixins may help, but not if it's same or less 
>> convenient to use as the double entry method.
>>
>> Any suggestions, or is it just impossible or not worth trying?
>
> I have not found good workaround for this so far and consider 
> it a main use case for template alias parameter enhancement.


There are other corner cases where alias for the inspect function 
will fail. For example, when used inside a class or struct 
method, a compiler error results stating that the symbol is not 
accessible to a non-global function.

It may be that enhancing alias is not the right way to solve this 
problem.

As was mentioned, the other method of importing and parsing the 
source file won't scale well and are ridiculous overkill for what 
should be a simple thing to do.

--rt


More information about the Digitalmars-d-learn mailing list