Okay, I realize there have been some discussions about this, but I have a few questions about shared delegates because right now they are definitely broken, but I'm not sure how.<div>Take this code example:</div><div><br>

</div><div><div>synchronized class Thing {</div><div>        void doSomeWork(void delegate() work) {</div><div>                work();</div><div>        }</div><div>        void work() {}</div><div>}</div><div><br></div>
<div>
void main() {</div><div>        auto th = new Thing();</div><div>        th.doSomeWork(&th.work);</div><div>}</div></div><div><br></div><div>This doesn't compile because the type of "&th.work" is "void delegate() shared", which cannot be cast implicitly to "void delegate()".</div>

<div>My first question would be whether that type is correct. It's true that the data pointer of the delegate points to a shared object, but given that the function locks it, does that really matter in this case? I guess I'm just not clear on the exact meaning of "shared" in general, but it seems like whether the data is shared or not is irrelevant when the delegate points to a public member of a synchronized class. If it was a delegate pointing to a private/protected member (which should be illegal in this case), that would not be true.</div>

<div>If that type is correct, the problem is that "void delegate() shared" doesn't parse as a type (there is a workaround because you can create variables of this type through alias and typeof).</div><div><br>

</div><div>What, exactly, is wrong here?</div>