Uncallable delegates

Meta jared771 at gmail.com
Sat May 16 04:40:35 UTC 2026


On Saturday, 16 May 2026 at 02:02:42 UTC, Walter Bright wrote:
> Thank you. It suggests to me like the problem is with the pure 
> inheritance.
>
> I suggest asking Gemini if it can reproduce the problem without 
> a `pure` annotation.

No, as per the explanation I posted, it's an interaction between 
a pure factory function and what looks like a type system hole 
relating to delegate signatures. ps.dq is `immutable(int* 
delegate())`, and the immutable is for some reason not 
transitively applied to the delegate's return type. Thus ps.dg() 
returns int*, and ps.q returns immutable(int*), but both pointers 
point to the same object on the heap.

It's not reproducible without the pure factory function, but the 
real issue lies with how immutable is transitively applied (or in 
this case, NOT applied) to delegate signatures.

I guess the solution is that `immutable(int* delegate())` should 
become `int* delegate() immutable`.


More information about the dip.development mailing list