Re: Placement of shared does not allow to set a delegate

2014-06-19 Thread Tolga Cakiroglu via Digitalmars-d-learn
Yes the understanding is correct. I simplified the code a little: IMPORTANT: DMD 2.065 is used. class Car{ void delegate() onEvent; } class Test{ this() shared { auto car = new shared Car(); assert( typeid( car.onEvent ).toString() == "shared(void dele

Re: Placement of shared does not allow to set a delegate

2014-06-16 Thread Ali Çehreli via Digitalmars-d-learn
On 06/16/2014 09:37 AM, Tolga Cakiroglu wrote: > On Monday, 16 June 2014 at 15:25:51 UTC, Ali Çehreli wrote: > Okay, now I continue with another thing. After defining the event > attribute as follows > > public void delegate( shared(SocketListener) sender ) shared > eventWhenStarted; > > > --- >

Re: Placement of shared does not allow to set a delegate

2014-06-16 Thread Tolga Cakiroglu via Digitalmars-d-learn
On Monday, 16 June 2014 at 15:25:51 UTC, Ali Çehreli wrote: Here is a minimal example that reproduces the issue and the hint that compiles the code: class SocketListener { public void delegate( shared(SocketListener) sender ) /* shared */// <-- UNCOMMENT TO COMPILE eventWhenSt

Re: Placement of shared does not allow to set a delegate

2014-06-16 Thread Tolga Cakiroglu via Digitalmars-d-learn
Thanks Ali. That has solved the problem. Actually I tried to use that `shared` as follows before: public shared void delegate( shared(BasicSocketListener) sender ) eventWhenStarted; Though it didn't work with that. When it is put "before" the attribute name, it works now. It is just confusin

Re: Placement of shared does not allow to set a delegate

2014-06-16 Thread Ali Çehreli via Digitalmars-d-learn
On 06/16/2014 05:35 AM, Tolga Cakiroglu wrote:> In a class I defined an event attribute as follows: > > public void delegate( shared(SocketListener) sender ) eventWhenStarted; > > --- > > An instance of SocketListener is created. > > auto listener = new shared SocketListener(); > > --- > > I defi

Placement of shared does not allow to set a delegate

2014-06-16 Thread Tolga Cakiroglu via Digitalmars-d-learn
In a class I defined an event attribute as follows: public void delegate( shared(SocketListener) sender ) eventWhenStarted; --- An instance of SocketListener is created. auto listener = new shared SocketListener(); --- I defined a shared method that will be called when the event occurs.