dcollections 1.0 and 2.0a beta released

bearophile bearophileHUGS at lycos.com
Mon May 24 13:03:00 PDT 2010


Steven Schveighoffer:

> complex code?
> a ~= b;
> Seems pretty not complex.

I meant on the implementation side. Arrays are used all the time, and they are basic blocks to be used everywhere so a programmer probably must understand how they work inside.


> That part is still pretty new.  What do you find is messy and complex  
> about it?

The internal semantics of the current design of dynamic arrays is not transparent enough, this means I often don't know what it is doing. This can be acceptable for a more complex data structure as the associative arrays.
And it's not easy to know exactly where to use assumeSafeAppend.
Despite their complexity, D dynamic arrays are not safe enough, see the small thread about passing D dynamic arrays by reference on default.


> When I said "good enough for most situations" I didn't mean "most  
> situations where appending speed is crucial to the success of the  
> application" :P

I have written few hundreds of small D programs, and I have seen that appending often happens (more often that I have originally thought) in points where performance is important enough. Using the Appender of my dlibs was usually able to solve the problem.

I don't know better solutions, so maybe I'm just wasting your time, I am sorry. Before seeing D I have never thought that designing good dynamic arrays can be so hard :-)

Bye,
bearophile


More information about the Digitalmars-d-announce mailing list