How does D improve design practices over C++?

Janderson ask at me.com
Thu Nov 6 20:43:52 PST 2008


Bill Baxter wrote:
>> C++ is a huge language, and not many know the entire language.  Case in
>> point, you didn't know what Delegates where yet many C++ programmers use
>> them frequently.  Its better if the language makes it easy rather then
>> requiring the programmer to do something to be correct.  Just like expecting
>> an email program to have spell check your emails.  Modern languages should
>> do the same.
> 
> C++ doesn't have "delegates".  It has member function pointers.  I
> don't think that's changed.  boost::bind (now std::tr1::bind in some
> places) gives you a way to bundle a member function pointer with an
> object pointer in a delegate-like way, but I don't think anybody calls
> those delegates.  At least they didn't used to.
> 
> I don't know who came up with the word "delegate" but I find it to be
> a terrible match for what they actually are.
> - "one appointed or elected to represent others"?
> It's a kind of a stretch. [/rant]
> 
> --bb

http://www.codeguru.com/cpp/cpp/cpp_mfc/pointers/article.php/c4135

Delegates in D are a little different from the original delegates which 
"delegate" to different methods (it they could have more then 
destination).  D delegates are more like C++ functors (which aren't 
built in either).

-Joel



More information about the Digitalmars-d mailing list