On Thursday, 14 March 2013 at 21:29:26 UTC, Timon Gehr wrote:
int foo(int delegate() dg){ return dg(); }

void main(){
    foo(delegate()=>2); // error, int delegate()pure immutable
                        // does not convert to int delegate()
}


OK, is it possible to consider naked delegate as const(void*) then ?

I think we should go for the usual instead of the covariant one as you propose. The regular will happen anyway and it is quite hard to keep everything together without introducing annoying rules.

For instance :

class Foo {
    delegate() bar;
}

Foo f = new Foo();
d.bar = { ... }
const g = f;
g.bar(); // ???

Reply via email to