Uncallable delegates

Walter Bright newshound2 at digitalmars.com
Wed Jun 17 17:34:55 UTC 2026


On 6/17/2026 3:16 AM, Timon Gehr wrote:
> Applying `const` to a delegate is fine. Calling a delegate that may require a 
> mutable context with a `const` context is not. You can't pass a `const` argument 
> with indirections to a mutable parameter. Except that for delegates, this is 
> currently not enforced. Dukc's DIP fundamentally just proposes consistently 
> enforcing this basic rule.

I do not understand how the DIP would work for this example.


> However, the call type checking and implicit conversion rules also should take 
> into account that we know that the context had the correct type and qualifier 
> when the delegate was initially created. Without this observation, it would be 
> consistent to reject _all_ delegate calls.

DIP1000 can transfer the attributes of the implicit this to the return type.


More information about the dip.development mailing list