DIP 1008 Preliminary Review Round 1
Jack Stouffer via Digitalmars-d
digitalmars-d at puremagic.com
Tue May 23 20:52:16 PDT 2017
On Monday, 22 May 2017 at 12:00:30 UTC, Nick Treleaven wrote:
> //FIXME: uniqueToString should return @nogc UniquePtr!(const
> char[])
> import std.conv;
> alias uniqueToString = to!(const char[]);
>
> class MessageEx(E, sinkArgs...) : E
> {
> this(A...)(A args)
> {
> super(args);
> }
>
> //FIXME: delegate not @nogc
> /*@nogc*/ override void toString(scope void delegate(in
> char[]) sink) const
> {
> foreach (a; sinkArgs)
> sink(uniqueToString(a));
> }
> }
>
> unittest
> {
> auto x = 7;
> throw new MessageEx!(Exception, "x = ", x)(null);
> }
>
> The result of uniqueToString would free any memory allocated
> after the call to sink.
Heh, I actually ran into this problem earlier today and just saw
this post https://issues.dlang.org/show_bug.cgi?id=17420
Weird coincidence.
More information about the Digitalmars-d
mailing list