How does D improve design practices over C++?

Christopher Wright dhasenan at gmail.com
Sat Nov 8 05:42:34 PST 2008


Jarrett Billingsley wrote:
> On Fri, Nov 7, 2008 at 11:13 PM, Christopher Wright <dhasenan at gmail.com> wrote:
>> 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.
> 
> All I was trying to do was explain where the name "delegate" may have come from.

Ah, sorry.
/me gives an embarrassed shrug.

Wikipedia mentions this 1986 paper: 
http://web.media.mit.edu/~lieber/Lieberary/OOP/Delegation/Delegation.html

It speaks of delegating messages to other objects, using that term.



More information about the Digitalmars-d mailing list