D array expansion and non-deterministic re-allocation

Leandro Lucarella llucax at gmail.com
Wed Nov 18 05:12:06 PST 2009


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).

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.

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Hey you, out there on your own
Sitting naked by the phone
Would you touch me?



More information about the Digitalmars-d mailing list