Get variable symbol name that was passed to a paramater?
Dicebot
public at dicebot.lv
Sun Nov 10 18:02:55 PST 2013
On Monday, 11 November 2013 at 00:59:03 UTC, Rob T wrote:
> 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.
What I mean is that template alias parameter is intended to be a
pass-by-name thing. But the way it works it capture the symbol
name tied to the type, not symbol name of actual instance. As it
is a template it should be always possible to refer to
variable/field valid in instantiating context via such aliased
name without loosing actual data context. But it will require
considerably more powerful alias definition.
More information about the Digitalmars-d-learn
mailing list