GSoC-2011 project:: Containers

spir denis.spir at gmail.com
Fri Mar 25 05:41:19 PDT 2011


On 03/25/2011 12:30 PM, Ishan Thilina wrote:
>     >>  But I found another set of
>     >>  implementations of data structures such as List from here (
>
>     >>  http://www.dprogramming.com/list.php ). And the latter List doesn't have the
> same methods that are in std.container. Why is this?
>
>> dprogramming.com is the personal website of Christopher Miller, and it's not
> affiliated with the D Programming Language. The code you'll find there are Chris's
> own>projects and libraries.
>
>> Christopher's List class was also written in 2006, way before std.container or
> even D2 existed.
>
>> --
>> Best regards,
>> Vladimir
>
>
> Ohh, Seems like that I have confused the things :s. Sorry for the mistake.
>
> I began to look at ranges, the concept is still new to me. I think I'll understand
> more about the implementation of std.container after getting used to ranges.
> Somebody please correct me if I'm taking a wrong turn.
>
> Thank you...!

You are right, indeed. To say it shortly, ranges are D's version of iterators 
or generators, especially powerful and general. With its own set of issues 
(somewhat complicated, rather opaque types, various bugs remaining), but 
globally extremely useful and usable.
Most of Phobos2 (the std lib) builds on ranges; this applies even more to 
collections: if you wish to implement new collections for D, it is certainly 
required that they hold range factories for iteration. Sometimes, more than one 
(eg tree traversal breadth-first vs depth-first, leaves only...).

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.

Use the D learn mailing list to ask people for help in understanding D's more 
advanced features and issues.

Denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d mailing list