On Wednesday, 18 February 2026 at 19:43:38 UTC, JN wrote:
import std;
void before()
{
writeln("Before");
}
void after()
{
writeln("After");
}
void add(int x, int y)
{
writeln(x + y);
}
template WrapCall(string call)
{
enum WrapCall = "before(); " ~ call ~ "; after();";
}
void main()
{
mixin WrapCall!"add(1, 2)";
}
This doesn't work, if I change it to mixin(WrapCall!"add(1,
2")), it works, why?
what do you mean why, thats a enum use this:
```d
void wrapcall(alias F,T...)(T args){
before;
F(args);
after;
}
```