Uncallable delegates

FeepingCreature feepingcreature at gmail.com
Wed May 13 02:31:43 UTC 2026


On Wednesday, 13 May 2026 at 02:19:04 UTC, FeepingCreature wrote:
> I agree with the DIP, as far as I understand it, but this 
> example does not seem like it is covered by it, and I don't 
> think it should be either. Am I missing something?

Addendum: I mean, you can get into hot water much more easily:

```
@safe:

class C {
   int x;
   void foo() const { meep(); }
}

C c;
void meep() { c.x ++; }

void main() {
   auto c = new C;
   .c = c;
   c.foo; // c.x mutates as an effect of a const call!
}
```

As far as I can tell this is totally unstoppable as global 
functions don't have const anyways. We'd need to consider the 
global scope as an implicit parameter so that it could be covered 
by constness even with global functions.


More information about the dip.development mailing list