On Sun, Jan 6, 2013 at 6:49 PM, Dmitry Olshansky <dmitry.olsh@gmail.com> wrote:
Regarding toString there is a better signature that avoids useless allocations:

void toString(scope void delegate(const (char)[]) sink);

It takes a delegate to output string representation directly to the destination via 'sink' delegate (that may e.g. write chars to file). Plus the 'scope' part of declaration avoids allocating the said delegate on the heap.

I'd even say that string toString(); is an artifact of the past, instead to!string should be used (if allocating a string is fine).

I know you explained that already, but see, that again slipped my mind. This toString(sink) thingy seems cool, but is there a documentation on it somewhere? Without a related doc, I fear no one will know this exists.