D - Delegates
- Sebastian Moleski (8/8) May 30 2003 Hi,
- Ilya Minkov (17/27) May 30 2003 Hello.
- Walter (5/7) May 30 2003 You have an excellent point. Put too much magic in, and people will lose
- Matthew Wilson (8/16) May 30 2003 C#/.NET supports both static & instance, and I think it's a good thing.
Hi, One thing that has always made me wonder when I see delegates (pointers to member functions): why not allow delegates be assigned static member functions or regular non-member functions? The way it could work is that the pointer to the object inside the delegate be set to null and, when the delegate is invoked, a run-time check is added to use proper call semantics.What do you all think? sm
May 30 2003
Hello. I believe that this would be too implicit. Ocassional assignment should be prevented statically. How about assignment trough closure or some other syntactic twist? I also don't believe in hiding "this" pointer. The distinction between normal functions/static methods and object methids could be alleviated - if you requiere that for a method to be non-static, it should declare a first input parameter named "this", for which the type either has to be a supertype of the object in which it's defined, or this type itself. It should also be possible to omit the type, which would implicitly mean the last case. "this" would also have to become a reserved word then. This would also force to add operator:: to call these functions which have "this" without assigning it to the current object. I believe this would make OO more acessible to people who don't believe in it (yet). Else you simply get a bit too much magic. -i. Sebastian Moleski wrote:Hi, One thing that has always made me wonder when I see delegates (pointers to member functions): why not allow delegates be assigned static member functions or regular non-member functions? The way it could work is that the pointer to the object inside the delegate be set to null and, when the delegate is invoked, a run-time check is added to use proper call semantics.What do you all think? sm
May 30 2003
"Ilya Minkov" <midiclub 8ung.at> wrote in message news:bb8cdm$2dqg$1 digitaldaemon.com...I believe this would make OO more acessible to people who don't believe in it (yet). Else you simply get a bit too much magic.You have an excellent point. Put too much magic in, and people will lose faith in it working. Me, I'm not comfortable coding unless I know exactly what the compiler is going to do with my code.
May 30 2003
I have no problem with your suggested mechanism, and confess I'm quite confused by the responses from Walter and Ilya. (Mind you I've spent about 36hrs of the last 48 writing documentation and test programs, so am probably running on vapour atm...) "Sebastian Moleski" <s.moleski tcu.edu> wrote in message news:bb860k$24m2$1 digitaldaemon.com...Hi, One thing that has always made me wonder when I see delegates (pointers to member functions): why not allow delegates be assigned static member functions or regular non-member functions? The way it could work is thatthepointer to the object inside the delegate be set to null and, when the delegate is invoked, a run-time check is added to use proper call semantics.What do you all think? sm
May 30 2003