Stroustrup's talk on C++0x

Bill Baxter dnewsgroup at billbaxter.com
Thu Aug 23 01:45:30 PDT 2007


Walter Bright wrote:
> Bill Baxter wrote:

>> but some are also available in g++ now, I believe.  And there are some 
>> features slated for  C++ 09 that aren't on the roadmap for D at all 
>> (like concepts
> 
> Concepts aren't a whole lot more than interface specialization, which is 
> already supported in D.

I'm not sure what you mean by that, but the feature that I liked most 
about it is interface checking.  So
A) Being able to document someplace that if you want to use my 
KewlContainer you must implement the KewlIteratorConcept which means, 
say, you support opPostInc() and opSlice() (for dereferencing as x[]).
and then once that is documented
B) being able to say that my class implements that concept and have the 
compiler check that indeed it does.

I suppose there may be some way to do all that in current D, but I think 
defining and implementing concepts should be as easy as defining and 
implementing a run-time interface.

Duck typing is nice, but if you look at even scripting language founded 
on the idea, like Python, you'll find that where people are putting 
together, they're also creating and using tools like zope.interface to 
get back some of the benefits of type checking.  At the end of the day, 
even with duck typing there are some requirements I have to fulfill to 
use my object with your function.  You want to be able to specify those 
things and have the compiler check it.

--bb



More information about the Digitalmars-d mailing list