How does D improve design practices over C++?

Christopher Wright dhasenan at gmail.com
Sun Nov 9 06:04:00 PST 2008


Michel Fortin wrote:
> On 2008-11-07 02:42:20 -0500, Walter Bright <newshound1 at digitalmars.com> 
> said:
> 
>> The difference between D delegates and boost::bind for member 
>> functions is that D delegates bind to the specific virtual function 
>> when the delegate is created, while boost::bind binds when the 
>> delegate is called. The former is, of course, more efficient when the 
>> delegate gets called more than once.
> 
> But the later makes it possible to call the same member function on 
> various object instances (which may resolve to different code for 
> virtual functions). I find that capability lacking in D.

You can do it in D, but only with templates. And it's ugly.

I must admit, I've never encountered a situation in which I wanted a 
pointer to a member function. What situations did you encounter this in? 
Why were, say, interfaces insufficient?



More information about the Digitalmars-d mailing list