Get variable symbol name that was passed to a paramater?

Rob T alanb at ucora.com
Sun Nov 10 17:06:33 PST 2013


On Sunday, 10 November 2013 at 00:08:11 UTC, Timothee Cour wrote:
[...]
> I've already asked for this in the past (see email: "feature 
> request:
> __ARGS__ for logging (cf __FILE__, __LINE__, __FUNC___):
>
> but Jacob pointed out that AST macros would make this 
> un-necessary (like
> wise with another proposal I made "proposal: a new string 
> litteral to embed
> variables in a string" ):
>
> "I don't think that __ARGS__ is a bad idea, I just think that 
> there are
> several features in D which could be replaced with a library 
> solution using
> AST macros (if those were available)"
>
> So let's either get a roadmap for introducing AST macros 
> (preferred) or
> let's allow this very simple __ARGS__ in the language.
>

Agreed. I did think that AST macro's may present a solution, also 
the __ARGS__ solution is a good possibility too. I use 
__PRETTY_FUNCTION__ a lot now that we finally got it, and 
__ARGS__ would be an excellent addition that I would definitely 
use.

If AST macros can allow us to define library solutions to create 
something like  __PRETTY_FUNCTION__ and __ARGS__, that would be 
the ultimate solution for sure.

--rt


More information about the Digitalmars-d-learn mailing list