On Tuesday, 9 September 2025 at 19:17:11 UTC, Steven
Schveighoffer wrote:
In short `opDispatch` only is valid if it compiles. If it
doesn't compile, it's as if it doesn't exist.
Yours still thinking declaratively, that cant be true. The best
description of its behavior is that it discards errors.
```d
import std;
enum counter=cast(immutable(void)*)[0].ptr;
auto getcount()=>(*(cast(int*)counter));
auto count()=>(*(cast(int*)counter))++;
struct foo{
void opDispatch(string s)(){
enum _=count();
static assert(0);
}
}
void bar(foo){}
void foobar(foo){}
unittest{
foo().bar;
foo().foobar;
getcount.writeln;//2
}
```