Thread overview
[Issue 20081] Add pragma(identifier, StringExp)
Jul 25, 2019
anonymous4
Jul 25, 2019
Manu
Jul 27, 2019
Ethan Watson
Aug 05, 2019
Adam D. Ruppe
Aug 05, 2019
Manu
Dec 17, 2022
Iain Buclaw
July 25, 2019
https://issues.dlang.org/show_bug.cgi?id=20081

--- Comment #1 from anonymous4 <dfj1esp02@sneakemail.com> ---
If you need only a name, you can just generate an alias:

mixin(q{ alias generatedName=staticName; });

Or forwarding:
mixin(q{ void generatedName(){ staticName(); } });

void staticName()
{
  //code here
}

--
July 25, 2019
https://issues.dlang.org/show_bug.cgi?id=20081

--- Comment #2 from Manu <turkeyman@gmail.com> ---
It's possible that I might have thought of that... ;)

--
July 27, 2019
https://issues.dlang.org/show_bug.cgi?id=20081

Ethan Watson <gooberman@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gooberman@gmail.com

--- Comment #3 from Ethan Watson <gooberman@gmail.com> ---
100% for this. There's a large chunk of code I can simplify by just defining things inline instead of having to provide extra workarounds like noted in all of the above posts.

Being able to arbitrarily override a symbol's identifier is going to have applications well outside of just this use case.

--
August 05, 2019
https://issues.dlang.org/show_bug.cgi?id=20081

Adam D. Ruppe <destructionator@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |destructionator@gmail.com

--- Comment #4 from Adam D. Ruppe <destructionator@gmail.com> ---
I'd actually prefer the syntax just to be mixin. Change the grammar so declaration names can be replaced with mixin(x) and the mixin must return an identifier as a string.

But regardless, yes, this would basically finish `static foreach` imo.

--
August 05, 2019
https://issues.dlang.org/show_bug.cgi?id=20081

--- Comment #5 from Manu <turkeyman@gmail.com> ---
mixin would be fine in that context... but it might look a little bit weird?

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=20081

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--