In general I actually like this idea, but can we still have sealed ref-counted arrays and associative arrays somewhere in Phobos (not necessarily any more esoteric containers than these and not necessarily in std.container, maybe in a new module called std.refcounted or something)? For huge arrays/AAs I think ref counting is an important optimization, especially with the GC in its current state but to a lesser extent even when we get a better GC. GC tends to be slow compared to manual memory management in cases where most allocated blocks are large.

Also, I like reference counting for huge arrays/AAs enough that I submitted a ref counted hash table implementation to the Phobos list for review, which noone seemed to notice. Please comment.

On 1/28/2011 1:31 PM, Andrei Alexandrescu wrote:
Today after work I plan to start making one pass through std.container.
After having thought of things for a long time, my conclusions are as
follows:

1. Containers will be classes.

2. Most of the methods in existing containers will be final. It's up to
the container to make a method final or not.

3. Containers and their ranges decide whether they give away references
to their objects. Sealing is a great idea but it makes everybody's life
too complicated. I'll defer sealing to future improvements in the
language and/or the reflection subsystem.

4. Containers will assume that objects are cheap to copy so they won't
worry about moving primitives.

Any showstoppers, please share.


Andrei

Reply via email to