On Thursday, 10 April 2014 at 10:16:43 UTC, Chris wrote:
because the two are not the same. When you print MyStruct to
console you get the address of appender buf, whereas when you
use string[] items you get the actual items. I'm only
wondereing if using appender is potentially dangerous and could
bite me later.
Why don't you implement "toString" on your type?
void toString(scope void delegate(const(char)[]) sink)
{
import std.format;
formattedWrite(sink, `%s`, "MyStruct(");
formattedWrite(sink, `"%s"`, name);
formattedWrite(sink, `%s`, ", ");
formattedWrite(sink, `%s`, buf.data);
formattedWrite(sink, `%s`, ")");
}