Re: delegate !is null

2009-09-10 Thread Steven Schveighoffer
On Tue, 08 Sep 2009 18:13:56 -0400, Saaa em...@needmail.com wrote: Hope this one makes any sense :) C c = new C; C mouseOverObject = c; int delegate() deleg = mouseOverObject.getSomeVariable; mouseOverObject = null; int value; void write() { if(deleg !is null) //how do I make this check for

Re: delegate !is null

2009-09-08 Thread Saaa
Steven Schveighoffer schvei...@yahoo.com wrote in message news:op.uzxs4wyreav...@localhost.localdomain... On Sun, 06 Sep 2009 18:54:47 -0400, Saaa em...@needmail.com wrote: I'd like to set D's delegate to a method which is not yet available (like c.method). I solved this by encapsulating

Re: delegate !is null

2009-09-08 Thread Steven Schveighoffer
On Tue, 08 Sep 2009 09:22:30 -0400, Saaa em...@needmail.com wrote: Steven Schveighoffer schvei...@yahoo.com wrote in message news:op.uzxs4wyreav...@localhost.localdomain... On Sun, 06 Sep 2009 18:54:47 -0400, Saaa em...@needmail.com wrote: I'd like to set D's delegate to a method which is

Re: delegate !is null

2009-09-08 Thread Saaa
The problem lies more in that I'd like to point to something which is not there yet. In the code 'c.method()' is not there yet, as c is null. Maybe I should create a dummy object for c to point to in stead of null ? That way I point the delegate to the dummy method and ignore it as long as

Re: delegate !is null

2009-09-08 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Saaa wrote: The problem lies more in that I'd like to point to something which is not there yet. In the code 'c.method()' is not there yet, as c is null. Maybe I should create a dummy object for c to point to in stead of null ? That way I point

Re: delegate !is null

2009-09-08 Thread Steven Schveighoffer
On Tue, 08 Sep 2009 12:40:13 -0400, Saaa em...@needmail.com wrote: Hm... I'm still confused. Why not just set the delegate to null? Why do you need to have the delegate set to something? It is for the gui. I give it a list of things to display. And some of these things don't yet exist or

Re: delegate !is null

2009-09-08 Thread Steven Schveighoffer
On Tue, 08 Sep 2009 16:15:49 -0400, Saaa em...@needmail.com wrote: // dg is now a instanceless delegate to C.method. dg.ptr = new C; So, nothing special under the hood, this would also work? C c= new C; dg.ptr = c; Yes, same thing. I also don't know how well it will work on interfaces.

Re: delegate !is null

2009-09-08 Thread Saaa
Hm... I'm still confused. Why not just set the delegate to null? Why do you need to have the delegate set to something? It is for the gui. I give it a list of things to display. And some of these things don't yet exist or can be deleted at any time. I'd like it to display the last valid

Re: delegate !is null

2009-09-08 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Saaa wrote: The only way I've found so far to do static binding like you are talking about is using string mixins. I need to rethink stuff a bit, but mixins might be the solution. My port of Atl's window classes uses a MFC like message map:

Re: delegate !is null

2009-09-06 Thread Saaa
Steven Schveighoffer schvei...@yahoo.com wrote in message news:op.uzqxxo1neav...@localhost.localdomain... On Fri, 04 Sep 2009 14:33:12 -0400, Saaa em...@needmail.com wrote: class C { private int i; int method() { return i; } } class D { private int delegate(void)