www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - containers/collections for phobos

reply Jonathan M Davis <jmdavisProg gmail.com> writes:
I was just wondering what the current plans were for containers/collections 
in phobos. Right now, there aren't any. It is, in my opinion at least, by 
far the largest drawback to phobos. Certainly, I think that that's the 
greatest advantage that tango has over phobos. Container classes are one of 
the first things that I look for in a standard library, and in that respect, 
phobos is sorely lacking.

Phobos has some great stuff in it. It even has highly innovative stuff like 
ranges which would be fantastic with containers/collections, but it lacks 
the container classes themselves. Granted, D arrays are absolutely fantastic 
(by far the best arrays that I've ever seen), but even with them being 
resizable and being able to be used as hash tables, they're no replacement 
for vectors, linked list, sorted maps, sets (sorted or otherwise), etc.

Are there any plans to add container/collection classes to phobos? I assume 
that they haven't been written yet because there have been higher 
priorities, but especially if we're looking to have D2 completed sometime in 
the near future, I would think that we'd want containers to be part of the 
standard library. Certainly, it's a major caveat for anyone looking to use 
D. At the moment, you either have to use 3rd party libraries or roll your 
own, and that's not exactly the ideal situation for something as basic and 
essential as container classes.

- Jonathan M Davis


P.S. I must say though, that ranges greatly simplify the writing of 
container classes. Most of the difficulties that I've had in writing my own 
have been in putting together good iterator implementations and everything 
that goes with that. Ranges could really set D containers/collections apart. 
They're so much like iterators, and yet so much better.
Dec 17 2009
next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Jonathan M Davis wrote:
 I was just wondering what the current plans were for containers/collections 
 in phobos.

After much discussions in this group and a lot of reflection, I believe I know exactly what there is to be done. It's now a matter of finding time to sit down and write the code. Most definitely there will be details that I hadn't thought of that will jitter the design quite a bit, but I don't expect anything dramatic. Andrei
Dec 18 2009
parent Jonathan M Davis <jmdavisProg gmail.com> writes:
Andrei Alexandrescu wrote:

 Jonathan M Davis wrote:
 I was just wondering what the current plans were for
 containers/collections in phobos.

After much discussions in this group and a lot of reflection, I believe I know exactly what there is to be done. It's now a matter of finding time to sit down and write the code. Most definitely there will be details that I hadn't thought of that will jitter the design quite a bit, but I don't expect anything dramatic. Andrei

That's great to hear. I look forward to it. D just keeps getting better and better. - Jonathan M Davis
Dec 18 2009
prev sibling parent reply "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Fri, 18 Dec 2009 00:01:40 -0500, Jonathan M Davis  
<jmdavisProg gmail.com> wrote:

 I was just wondering what the current plans were for  
 containers/collections
 in phobos. Right now, there aren't any. It is, in my opinion at least, by
 far the largest drawback to phobos. Certainly, I think that that's the
 greatest advantage that tango has over phobos. Container classes are one  
 of
 the first things that I look for in a standard library, and in that  
 respect,
 phobos is sorely lacking.

I'm not sure if it will be acceptable for inclusion into Phobos, but dcollections *will* be ported to D2. It already is a viable option for D1 phobos. http://www.dsource.org/projects/dcollections -Steve
Dec 18 2009
next sibling parent Tim Matthews <tim.matthews7 gmail.com> writes:
On 19/12/2009 3:12 p.m., Steven Schveighoffer wrote:
 On Fri, 18 Dec 2009 00:01:40 -0500, Jonathan M Davis
 <jmdavisProg gmail.com> wrote:

 I was just wondering what the current plans were for
 containers/collections
 in phobos. Right now, there aren't any. It is, in my opinion at least, by
 far the largest drawback to phobos. Certainly, I think that that's the
 greatest advantage that tango has over phobos. Container classes are
 one of
 the first things that I look for in a standard library, and in that
 respect,
 phobos is sorely lacking.

I'm not sure if it will be acceptable for inclusion into Phobos, but dcollections *will* be ported to D2. It already is a viable option for D1 phobos. http://www.dsource.org/projects/dcollections -Steve

I haven't actually looked at that code but my thoughts on this anyway: If ranges are to stay then if possible I would like to see any collection implementation designed to work well along side them rather than many different inconsistent ways to achieve the same thing.
Dec 18 2009
prev sibling parent KennyTM~ <kennytm gmail.com> writes:
On Dec 19, 09 10:12, Steven Schveighoffer wrote:
 On Fri, 18 Dec 2009 00:01:40 -0500, Jonathan M Davis
 <jmdavisProg gmail.com> wrote:

 I was just wondering what the current plans were for
 containers/collections
 in phobos. Right now, there aren't any. It is, in my opinion at least, by
 far the largest drawback to phobos. Certainly, I think that that's the
 greatest advantage that tango has over phobos. Container classes are
 one of
 the first things that I look for in a standard library, and in that
 respect,
 phobos is sorely lacking.

I'm not sure if it will be acceptable for inclusion into Phobos, but dcollections *will* be ported to D2. It already is a viable option for D1 phobos. http://www.dsource.org/projects/dcollections -Steve

At least you need to use the Boost license. ;)
Dec 19 2009