On 8/30/11 8:59 PM, Paul D. Anderson wrote:
Can someone clarify for me the status and/or direction of string
formatting in D?
[snip]

I agree there are major inefficiencies and composability problems caused by a blind toString() that creates a whole new string without any assistance. So we need to fix that.

There are suggestions to add this method to Object:

void writeTo(void delegate(const(char)[]) sink, string format = null);

Then, the suggestion goes, whether or not we deprecate toString, in the short term it should be implemented in terms of writeTo.

There are a few questions raised by this proposal:

1. Okay, this takes care of streaming text. How about streaming in binary format?

2. Since we have a relatively involved "output to text" routine, how about an "input from text" routine? If writeTo is there, where is readFrom?


Andrei

Reply via email to