[Issue 11138] "real" appender missing

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 20 03:32:43 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11138



--- Comment #5 from Dmitry Olshansky <dmitry.olsh at gmail.com> 2013-10-20 03:32:42 PDT ---
(In reply to comment #0)
> Lets call "real" an appender which will create the one and only array, i.e. it
> will not randomly create a copy of array on appending. Such copy is bad as:
> 1. Almost no use.
>     In 99% appender is used as "real" appender and the copy is not needed.
> 2. Performance.
>     It will cause calls of postblits and then destructors on collection of copy
> array.
> 3. Needless restriction on element type.
>     One may want to create and array of uncopyable type which non-"real"
> appender can't do by definition.

4. Support building stuff other then built-in array on GC heap.

5. Deterministic memory management. There is no point in keeping discarded
memory flaoting around after the final array is produced.

6. (sky is the limit) Use the allocators if such an ephemeral thing ever comes
to materialize.

> Obviously, "real" appender is uncopyable and don't give safe access to its
> array until it finished.

Honestly the thing current Appender is used for is a Builder. 
As in StringBuilder of C#/Java minus the madness of extra methods. 

With rebranding it as Builder and few extra points I'm all for it :)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list