digitalmars.dip.ideas - `__CONTEXT__` special token
- monkyyy (22/22) Dec 22 2025 the special token sequence acts like other but is lowered to
the special token sequence acts like other but is lowered to
`mixin("context")`
```d
int context=0;
int counter(ref int i=__CONTEXT__)=>++i;
unittest{
assert(counter==1);
assert(counter==2);
}
unittest{
float context;
//assert(counter==3);//Error counter(float) doesnt exist. using
existing type safety contexts wouldnt get confused
}
unittest{
int i;
assert(counter(i)==1);//by overwriting the default argument it
trivially replaceable by being explict
assert(counter(i)==2);
}
```
https://forum.dlang.org/thread/rpqppcvebeblghmrcyjj forum.dlang.org
Dec 22 2025








monkyyy <crazymonkyyy gmail.com>