Tango collections

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Wed Mar 21 10:36:18 PDT 2007


Sean Kelly wrote:
> 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).

Same here. I was hoping that ever since the STL came up, there was no
looking back at Java-style containers in a language that supports generics.

> 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.

Yah. Ranges have turned out to be a very useful addition to the STL as well.

> 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.

I know how that feels :o|. But my guess (while having about zero idea
about the possible politics involved) is that nobody will ever pick up 
work on DTL unless the Tango team decides to do so.

>> 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 :-)

Sounds great, thanks.


Andrei



More information about the Digitalmars-d mailing list