How does D improve design practices over C++?

Christopher Wright dhasenan at gmail.com
Fri Nov 7 20:13:05 PST 2008


Jarrett Billingsley wrote:
> I don't know if C# had them first or what, but the name.. fits
> somewhat better there.  C#'s delegates are something like D's
> delegates combined with a signals and slots implementation.  So you
> can think of a delegate as not being a method itself, but rather a
> representative to all the objects+methods that have subscribed to it.
> It's still not really a good fit ;)  But you make do with what you
> have.

In C#, there is the event type (System.Event) and the delegate type 
(System.Delegate). A delegate is pretty much the same as it is in D. An 
event is a collection of delegates that can be called as one function. 
You can add and remove delegates from it.

Delegates are used in the signals and slots implementation, but so what? 
You can get the same in D.



More information about the Digitalmars-d mailing list