it's time to change how things are printed
Fawzi Mohamed
fawzi at gmx.ch
Thu Nov 18 08:15:47 PST 2010
On 18-nov-10, at 16:53, Steven Schveighoffer wrote:
> On Thu, 18 Nov 2010 10:44:00 -0500, Nick Sabalausky <a at a.a> wrote:
>
>> I like it, *provided that* there's a quick-and-easy way to just get
>> a string
>> when that's all you want. At the very least there should be a
>> standard sink
>> function that's a default argument to toString that just simply
>> builds a
>> string. What we definitely *don't* want is for the user to ever
>> have to
>> write their own sink delegate just to get a string (which I've had
>> to do
>> with Tango on occasion).
>
> to!string(x);
>
> (which will probably do the delegate/etc when x.toString is defined)
I don't know I considered using the to!(T) conversion, but decided
against it in blip, because I preferred having to for exact
conversion, and use another set of methods for string conversion (that
is special enough, and sometime used just for debugging, and not
invertible).
by the way another nice effect of using a simple sink delegate is that
you can easily redeclare it at low level and get rid of dependencies
(well maybe you suffer a bit converting basic types, but it is doable)
Whereas using higher level streams is difficult in the runtime (you
easily have object depending on them, forcing you to put them in
object.d)
Fawzi
More information about the Digitalmars-d
mailing list