GSoC-2011 project:: Containers

Jonathan M Davis jmdavisProg at gmx.com
Fri Mar 25 15:37:26 PDT 2011


On 2011-03-25 05:41, spir wrote:
> About D collections: aside std.container in Phobos, Steven Schweighoffer
> has a fairly advanced project called dcollections:
> http://www.dsource.org/projects/dcollections. As I understand it, it is a
> bit of a concurrent for std.container, but there seems to be a possibility
> for them to converge in the future. In any case, you should definitely
> study it, if only to take inspiration and avoid double work.

dcollections is Steven Schweighoffer's project which has existed since D1. 
std.container is the container module for Phobos. So, they aren't, strictly 
speaking related. When designing std.container and planning out how containers 
should be done in Phobos, Andrei took a different approach than Steve did. So, 
nothing can be taken from dcollections and simply plopped into std.container. 
However, dcollections 2.0 does use the Boost license, so the code from there 
can be refactored to work in std.container. Steve already did that with 
RedBlackTree. He ported std.RedBlackTree from whatever his red-black tree 
implementation is in dcollections. So, if it makes sense, code can be taken 
from dcollections and ported to Phobos (and Steve would obviously be a good 
guy to talk to about that). However, anyone doing that needs to be aware of 
the differences in how dcollections works vs how std.container works (e.g. 
dcollections has cursors whereas std.container uses ranges exclusively).

Regardless, a solid understanding of ranges is required to create containers 
for std.container. At the moment, the only good resources that I'm aware of 
for learning about them are Andrei's original article, the talk he did at 
BoostCon 2009 ( http://boostcon.blip.tv/ ) - though that's geared towards C++ 
- and by reading code. std.range and std.algorithm in particular are based 
heavily on ranges. We probably do need more articles on ranges though. I keep 
thinking that I should write one (since no one else has AFAIX), but I haven't 
gotten around to it.

- Jonathan M Davis


More information about the Digitalmars-d mailing list