Template constraints in D

Bill Baxter dnewsgroup at billbaxter.com
Sun Jun 22 17:32:01 PDT 2008


Walter Bright wrote:
> Bill Baxter wrote:
>> But of course the main benefit of concept maps is that when I want to 
>> plug Vinces's Vector class into Larry's LinearSolver class all I have 
>> to do is specify how Vince's Vector satisfies Larry's VectorConcept.  
>> And it doesn't matter if Vince overloaded opMul to mean dot product, 
>> but Larry expects a member named "dot".
> 
> You can do that with a proxy object.

A) How exactly?  If you're going to claim it's equivalent, I think the 
burden is on you to show an example of it.

B) Whatever you have in mind, my hunch is that it is going to be 
significantly more cumbersome.  For example in my code I like using 
Vince's Vector.  I like his API.  But if I go with proxy objects then I 
think that means either I have to use the proxy object (with Larry's 
API) instead of Vince's Vector directly, or else every time I call 
Larry's code I have to wrap my Vince Vector in a Larry VectorConcept 
proxy wrapper.  Either way it's not ideal, and more cumbersome than just 
writing down the mapping once in one central place.


>> Maybe if you haven't yet you could talk it over with Andrei.  My 
>> experience is that discussing things with you here on the NG is not 
>> all that productive because you only ever respond with one or two 
>> sentences, so that's all I'm going to say about this.
> 
> I find it difficult to have productive discussions via email (even with 
> Andrei). The upcoming D conference, however, will give everyone a chance 
> for face-to-face.

Everyone who can be there at least.  Anyway, I think you need to find 
someone who understands the ins and outs of C++0x concepts and discuss 
with them face-to-face whether your plan for D covers all the bases 
sufficiently or not.

--bb



More information about the Digitalmars-d mailing list