www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - State of std.container redesign

reply David Nadlinger <see klickverbot.at> writes:
If I remember correctly, Andrei proposed a redesign of std.container 
here on digitalmars.D not too long ago, which included switching to 
final classes for container types.

However, I can't quite remember the outcome of the discussion, and there 
don't seem to be any related changes by now. Is this idea simply pending 
implementation, or did you change your mind on this, Andrei?

David
Mar 30 2011
next sibling parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
On 2011-03-30 06:15, David Nadlinger wrote:
 If I remember correctly, Andrei proposed a redesign of std.container
 here on digitalmars.D not too long ago, which included switching to
 final classes for container types.
 
 However, I can't quite remember the outcome of the discussion, and there
 don't seem to be any related changes by now. Is this idea simply pending
 implementation, or did you change your mind on this, Andrei?

The main thing was that all of the containers would become classes rather than structs which used reference counting. RedBlackTree has already been changed (in git), but the others haven't been yet. - Jonathan M Davis
Mar 30 2011
parent reply Ishan Thilina <ishanthilina gmail.com> writes:
The main thing was that all of the containers would become classes rather than
structs which used reference counting. RedBlackTree has already been changed
(in git), but the others haven't been yet.

Hi, I'm the one who is interested in the GSoC project "Containers". Should the containers that I ( or anyone who gets eligible to do the project ) implement be based on structs or classes?
Mar 30 2011
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 3/30/11 1:07 PM, Steven Schveighoffer wrote:
 On Wed, 30 Mar 2011 13:52:29 -0400, Ishan Thilina
 <ishanthilina gmail.com> wrote:

 The main thing was that all of the containers would become classes
 rather than
 structs which used reference counting. RedBlackTree has already been
 changed
 (in git), but the others haven't been yet.

Hi, I'm the one who is interested in the GSoC project "Containers". Should the containers that I ( or anyone who gets eligible to do the project ) implement be based on structs or classes?

Most definitely final classes. I think Andrei has already decided to change the existing ones to classes, and RedBlackTree already is a class in the source tree (not yet in the released version). -Steve

That is correct. We're looking for classes, preponderently final classes. Emphasis is not on hierarchy due to the many possible characteristics of containers, but instead on name conformance. Andrei
Mar 30 2011
prev sibling next sibling parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Wed, 30 Mar 2011 13:52:29 -0400, Ishan Thilina <ishanthilina gmail.com>  
wrote:

 The main thing was that all of the containers would become classes  
 rather than
 structs which used reference counting. RedBlackTree has already been  
 changed
 (in git), but the others haven't been yet.

Hi, I'm the one who is interested in the GSoC project "Containers". Should the containers that I ( or anyone who gets eligible to do the project ) implement be based on structs or classes?

Most definitely final classes. I think Andrei has already decided to change the existing ones to classes, and RedBlackTree already is a class in the source tree (not yet in the released version). -Steve
Mar 30 2011
prev sibling next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On 2011-03-30 10:52, Ishan Thilina wrote:
The main thing was that all of the containers would become classes rather
than structs which used reference counting. RedBlackTree has already been
changed (in git), but the others haven't been yet.

Hi, I'm the one who is interested in the GSoC project "Containers". Should the containers that I ( or anyone who gets eligible to do the project ) implement be based on structs or classes?

They should all be final classes. It was already the design that all container types should have reference semantics, but Andrei tried to implement them initially as structs with reference semantics using ref counting, and that ran into problems, so it was decided to just make them all final classes. That way, inlining is still possible (thanks to final), and they're quite clearly reference types. - Jonathan M Davis
Mar 30 2011
prev sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 03/30/2011 08:15 AM, David Nadlinger wrote:
 If I remember correctly, Andrei proposed a redesign of std.container
 here on digitalmars.D not too long ago, which included switching to
 final classes for container types.

 However, I can't quite remember the outcome of the discussion, and there
 don't seem to be any related changes by now. Is this idea simply pending
 implementation, or did you change your mind on this, Andrei?

 David

Yes, the idea is to use classes instead of structs. That simplifies implementation a fair amount. Andrei
Mar 30 2011