[OT] Finding longest documents

Benji Smith dlanguage at benjismith.net
Tue Oct 14 18:38:40 PDT 2008


Andrei Alexandrescu wrote:
> Christopher Wright wrote:
>> Actually, I STRONGLY urge that nobody use this heap.
>>
>> It's a struct. If you access it by value and append to it, then access 
>> it from any other alias, you will erase a random element from the heap.
>>
>> If it were a class, this would not be possible. As I implemented it, 
>> it would not be possible.
>>
>> Containers as value types is such an idiotic idea for precisely this 
>> reason.
> 
> I'd say this statement reflects a lack of understanding of value types, 
> rather than value containers are an idiotic idea.
> 
> Andrei

I'll bite.

Why is it a good idea that containers are implements as structs?

I too was pretty astonished to discover this pattern in tango. And why 
just for a few container types? Stack, Heap, and Vector are structs, 
while all other container types are classes.

--benji



More information about the Digitalmars-d mailing list