Frits van Bommel wrote:
Andrei Alexandrescu wrote:
Steven Schveighoffer wrote:
So I'd rather have a sink function.
It must be a sink _object_ so it can hold its own state. And it must
support put() so it integrates with statically-bound output ranges.
interface OutRange
{
void put(... a number of overloads ...);
}
What exactly is the problem with requiring the input to the sink to be a
string (or actually const(char)[])?
You'd be forced to use intermediate strings for everything. I guess it's
not a huge concern.
Requiring an overload for every basic type + Object would be quite
cumbersome if you had to do it every time you want to send the output
somewhere else. Also, it wouldn't work for structs and unions...
(Unless you plan to implement a default OutRange that converts
everything it gets to strings and passes it on?)
I'm thinking of only allowing a few fundamental types and then have user
code build the rest using them.
Andrei