Tango collections

Sean Kelly sean at f4.ca
Wed Mar 21 10:27:04 PDT 2007


Andrei Alexandrescu (See Website For Email) wrote:
> I'm seeing that Tango implements Java-style collections. Is there any 
> work going on implementing STL-style collections in Tango?

This is probably more a question for the Tango forums, but I'll reply 
briefly here anyway :-)  In my opinion, the choice of a container 
package for Tango was as much from necessity as it was from merit.  Doug 
Lea's containers were available and obviously well-designed, and we 
simply didn't have the time to design something entirely from scratch 
given the development effort for Tango as a whole.  That said, Kris 
spent a great deal of time bringing the package more in-line with our 
needs, and I do feel the result is quite solid and consistent.  My 
issues with it are largely cosmetic (I come from a C++ background and 
don't like the Java approach to interface design).

As for alternate designs, etc, I'll admit that I was hoping Matthew 
would find some time to work on DTL.  Some of the fundamental ideas 
present in that library are good ones, but it's simply far too rough to 
use as more than reference material.  Also, I feel the proper approach 
for iterators in D is closer to the Java-style, so a single iterator 
that knows where it is rather than a pair of dumb iterators to represent 
range.  There was an extensive discussion of iterators here maybe six 
months ago, and I followed this with a rough proposal which summed 
things up.  I can't remember the thread names offhand, but I can dig 
around for them if you missed the discussion.

I'll admit that I wouldn't mind taking a crack at this myself, but from 
experience I think it's unlikely I'll have much time for user-level code 
before Tango reaches 1.0.  Something always seems to come up that pulls 
me back into working on low-level features.

> Also, I'm seeing some needless Javaisms in the interface, e.g. int 
> ArraySeq.capacity(), which should be uint. At the same time other 
> functions, e.g. ArraySeq.instances(), return uint! What gives?

There is still some cleanup work to be done, and I suspect capacity() 
was simply overlooked.  Submitting tickets for problems you find is the 
best way to ensure that one of remembers to do something about it :-)


Sean



More information about the Digitalmars-d mailing list