dcollections 1.0 and 2.0a beta released

Steven Schveighoffer schveiguy at yahoo.com
Thu May 20 03:34:42 PDT 2010


Robert Jacques Wrote:

> On Wed, 19 May 2010 21:42:35 -0400, Steven Schveighoffer 
> >
> > Does that make sense?
> >
> > -Steve
> 
> Yes and No. I understand where your coming from, but I think it's a bad  
> idea. First, I think it needlessly expands the radius of comprehension  
> needed to understand and use the library. (See Tangled up in tools  
> http://www.pragprog.com/magazines/2010-04/tangled-up-in-tools) Second, I  
> think designing a library to be flexible enough to meet some future,  
> anticipated need (e.g. dlls) is a good idea, but actually implementing  
> vaporous future needs is fraught with peril; it's too easy to guess wrong.  
> Third, interface base design is viral; If library X uses interfaces then I  
> have to use interfaces to interface with it. And if another library Y uses  
> classes, then I'm going have to write a (needless) wrapper around one of  
> them.

I understand these points, but I'm already using interfaces to copy data between containers.  I don't have to, I could have used generic code, but this way, only one function is instantiated to copy data from all the other containers.  The problem with using generic code is that the compiler will needlessly duplicate functions that are identical.

Using interfaces is not as viral as you think.  My interfaces can be used in generic code, as long as the generic code uses functions in the interfaces.  If a library returns an interface, the author is saying "I don't want you using any functions outside this interface," so why is that a bad thing?

Forcing people to *not* use interfaces has its drawbacks too.  Dcollections gives the most flexible design I could muster, while still being useful.

I'm not saying I'm against removing the interfaces until some later date, but I don't see any convincing arguments yet, especially since I've already seen benefits from having them.

-Steve


More information about the Digitalmars-d-announce mailing list