Sink is okay, but most my usages belong to one of the two scenarios:
1) I need a string representation of an Object - how is Sink useful here? I
just want to call obj.toString() and get the result
2) I need to print it to stdout, thus I call writeln/Stdout(obj); - Sink is of
no use here again.
Needs simple converter code, that safe you from typing trivial stuff
like this:
toString((char[] s) { writeln(s); });
void toString(Sink sink, string format = null) {
// what should I do here? How do I avoid allocations? I have to
duplicate code anyway
char[16] buffer;
buffer = std.string.format(buffer, format, _number);
sink(buffer);
The idea is to add a format() function that takes sink() for output:
std.string.format(sink, yourformat, _number);
Besides, why is it called toString(), if it doesn't give me an object's string
representation???
Should be called debug_output() or something similar.