D array expansion and non-deterministic re-allocation

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Nov 18 07:22:31 PST 2009


Leandro Lucarella wrote:
> Andrei Alexandrescu, el 17 de noviembre a las 18:45 me escribiste:
>>> 3.  If you **really** care about performance, you should only append when you
>>> don't know the length in advance.  If you know the length, you should always
>>> pre-allocate.
>> We will have collections and all those good things, but I don't see
>> how the proposal follows from the feedback. My perception is that
>> this is a group of people who use D. Bartosz' concern didn't cause
>> quite a riot, so as far as I can tell there is no big issue at
>> stake.
> 
> I didn't say anything (until now) because this was discussed already.
> Dynamic arrays/slices appending is horribly broken (I know it's well
> defined, and deterministic, but you are just condemned to make mistakes,
> it just doesn't work as one would expect, even when you know how it works
> you have to keep fighting your intuition all the time).

In which ways do you think arrays horribly broken? Same as Bartosz mentions?

One question is whether you actually have had bugs and problems coding, 
or if arrays stopped you from getting work done.

> But it's a little pointless to keep making riots, when we were so close to
> finally fix this with T[new]/whatever and it all went back.

Hmmmm... resignation is not a trait of this group :o).


Andrei



More information about the Digitalmars-d mailing list