Appender and Array

Jonathan M Davis jmdavisProg at gmx.com
Thu Feb 7 20:07:31 PST 2013


On Friday, February 08, 2013 03:24:14 bearophile wrote:
> [I don't know what's the right group to post this. Maybe the main
> D group is better.]
> 
> This is a recently closed enhancement request about adding the
> "~=" operator and more to Appender:
> 
> http://d.puremagic.com/issues/show_bug.cgi?id=4287
> 
> I have discussed about the idea of also adding a length attribute
> to an Appender. Thinking about it, isn't it possible and a good
> idea to deprecate the Phobos Appender, improve std.array.Array
> appending performance (if necessary), and add a "data" attribute
> to Array (if necessary), to replace the use cases of Appender
> with Array?

Appender and Array are trying to do two completely different things. Appender 
is specifically for making appending to an array efficient. It's _not_ a 
container. Array, on the other hand, is actually a container, and it's not 
necessarily optimized specifically for appending. Not to mention, Appender is a 
wrapper for an array. If I wanted to use Array, I'd use Array, but if I used 
Appender, I'm obviously interested in using a built-in array, not Array.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list