Runtime code reloading in D, part 1
Benjamin Thaut
code at benjamin-thaut.de
Sun Jan 6 12:58:30 PST 2013
Am 06.01.2013 20:55, schrieb Philippe Sigaud:
> On Sun, Jan 6, 2013 at 6:49 PM, Dmitry Olshansky <dmitry.olsh at gmail.com
> <mailto:dmitry.olsh at 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.
>
There was a language change request for it in the wiki, but I can't find
it anymore.
Kind Regards
Benjamin Thaut
More information about the Digitalmars-d-announce
mailing list