On Thursday, 25 April 2019 at 23:41:32 UTC, Suleyman wrote:
Hello everyone,
I am happy to announce that in the next DMD release you will be
able to more freely enjoy your metaprograming experience now
that a long-standing limitation has been lifted.
You can now instantiate local and member templates with local
symbols.
Example:
---
struct S
{
private int _m;
void exec(alias fun)()
{
fun(_m);
}
}
unittest
{
int localVar;
void set(int i)
{
localVar = i;
}
auto obj = S(10);
obj.exec!set(); // no error or warning
assert(localVar == 10);
}
---
I hope you enjoy!
You have no idea how happy I am to hear this has been fixed! So
many of my designs have been hamstrung by 5710, and it's been
around since the dawn of time.
--
Simen